From 5902725be208fa805862bf92229d196b0f676b33 2012-03-08 22:53:09 From: MinRK Date: 2012-03-08 22:53:09 Subject: [PATCH] nbjson.writes always returns unicode --- diff --git a/IPython/nbformat/v3/nbjson.py b/IPython/nbformat/v3/nbjson.py index 558a613..5c63a4e 100644 --- a/IPython/nbformat/v3/nbjson.py +++ b/IPython/nbformat/v3/nbjson.py @@ -24,6 +24,8 @@ from .rwbase import ( NotebookReader, NotebookWriter, restore_bytes, rejoin_lines, split_lines ) +from IPython.utils import py3compat + #----------------------------------------------------------------------------- # Code #----------------------------------------------------------------------------- @@ -56,7 +58,7 @@ class JSONWriter(NotebookWriter): kwargs['separators'] = (',',': ') if kwargs.pop('split_lines', True): nb = split_lines(copy.deepcopy(nb)) - return json.dumps(nb, **kwargs) + return py3compat.str_to_unicode(json.dumps(nb, **kwargs), 'utf-8') _reader = JSONReader()