##// END OF EJS Templates
nbjson.writes always returns unicode
MinRK -
Show More
@@ -24,6 +24,8 b' from .rwbase import ('
24 NotebookReader, NotebookWriter, restore_bytes, rejoin_lines, split_lines
24 NotebookReader, NotebookWriter, restore_bytes, rejoin_lines, split_lines
25 )
25 )
26
26
27 from IPython.utils import py3compat
28
27 #-----------------------------------------------------------------------------
29 #-----------------------------------------------------------------------------
28 # Code
30 # Code
29 #-----------------------------------------------------------------------------
31 #-----------------------------------------------------------------------------
@@ -56,7 +58,7 b' class JSONWriter(NotebookWriter):'
56 kwargs['separators'] = (',',': ')
58 kwargs['separators'] = (',',': ')
57 if kwargs.pop('split_lines', True):
59 if kwargs.pop('split_lines', True):
58 nb = split_lines(copy.deepcopy(nb))
60 nb = split_lines(copy.deepcopy(nb))
59 return json.dumps(nb, **kwargs)
61 return py3compat.str_to_unicode(json.dumps(nb, **kwargs), 'utf-8')
60
62
61
63
62 _reader = JSONReader()
64 _reader = JSONReader()
General Comments 0
You need to be logged in to leave comments. Login now