diff --git a/IPython/frontend/html/notebook/notebookmanager.py b/IPython/frontend/html/notebook/notebookmanager.py index 15d8bb471da..78ca7615947 100644 --- a/IPython/frontend/html/notebook/notebookmanager.py +++ b/IPython/frontend/html/notebook/notebookmanager.py @@ -213,7 +213,7 @@ def save_notebook_object(self, notebook_id, nb): if self.save_script: pypath = os.path.splitext(path)[0] + '.py' try: - with io.open(pypath,'w') as f: + with io.open(pypath,'w', encoding='utf-8') as f: current.write(nb, f, u'py') except Exception as e: raise web.HTTPError(400, u'Unexpected error while saving notebook as script: %s' % e)