From 4a05091536690c8bd9934ce26df971a8eb57137b 2013-07-15 23:15:32 From: Jonathan Frederic Date: 2013-07-15 23:15:32 Subject: [PATCH] Fixed unicode data not written to files properly. --- diff --git a/IPython/nbconvert/transformers/extractfigure.py b/IPython/nbconvert/transformers/extractfigure.py index d9d0fb3..952c749 100755 --- a/IPython/nbconvert/transformers/extractfigure.py +++ b/IPython/nbconvert/transformers/extractfigure.py @@ -76,7 +76,9 @@ class ExtractFigureTransformer(ActivatableTransformer): if out_type in ('png', 'jpg', 'pdf'): data = data.decode('base64') elif sys.platform in WINDOWS_PLATFORMS: - data = data.replace('\n', '\r\n') + data = data.replace('\n', '\r\n').encode("UTF-8") + else: + data = data.encode("UTF-8") #Build a figure name figure_name = self.figure_filename_template.format(