From 1eff338534652e76d57f7ce61cc4ce1870efb60b 2012-08-01 00:03:34 From: Bradley M. Froehle Date: 2012-08-01 00:03:34 Subject: [PATCH] Use `io.open` ensure the file is read as UTF-8. --- diff --git a/IPython/extensions/cythonmagic.py b/IPython/extensions/cythonmagic.py index 9a707a0..edb2e03 100644 --- a/IPython/extensions/cythonmagic.py +++ b/IPython/extensions/cythonmagic.py @@ -193,7 +193,8 @@ class CythonMagics(Magics): self._import_all(module) if args.annotate: - with open(os.path.join(lib_dir, module_name + '.html')) as f: + html_file = os.path.join(lib_dir, module_name + '.html') + with io.open(html_file, encoding='utf-8') as f: annotated_html = f.read() return display.HTML(annotated_html)