From e238d5b073bbe7541fa627908eecee733b42c95d 2013-09-03 22:48:52 From: MinRK Date: 2013-09-03 22:48:52 Subject: [PATCH] don't 'restore_bytes' in from_JSON it makes no sense to turn base64-encoded unicode strings into base64-encoded byte strings. I can't think why we do this, but we should be very careful about testing before merging this fix. fixes the issue tested in #4036. --- diff --git a/IPython/nbformat/v3/nbbase.py b/IPython/nbformat/v3/nbbase.py index bac60df..032a34f 100644 --- a/IPython/nbformat/v3/nbbase.py +++ b/IPython/nbformat/v3/nbbase.py @@ -69,9 +69,9 @@ def new_output(output_type=None, output_text=None, output_png=None, if output_text is not None: output.text = unicode(output_text) if output_png is not None: - output.png = bytes(output_png) + output.png = unicode(output_png) if output_jpeg is not None: - output.jpeg = bytes(output_jpeg) + output.jpeg = unicode(output_jpeg) if output_html is not None: output.html = unicode(output_html) if output_svg is not None: diff --git a/IPython/nbformat/v3/nbjson.py b/IPython/nbformat/v3/nbjson.py index 5c63a4e..be9ee28 100644 --- a/IPython/nbformat/v3/nbjson.py +++ b/IPython/nbformat/v3/nbjson.py @@ -46,7 +46,7 @@ class JSONReader(NotebookReader): return nb def to_notebook(self, d, **kwargs): - return restore_bytes(rejoin_lines(from_dict(d))) + return rejoin_lines(from_dict(d)) class JSONWriter(NotebookWriter):