From 1e80ceedf30ff3f737edd55197bd3a182a009b2a 2011-12-15 21:32:36 From: Thomas Kluyver Date: 2011-12-15 21:32:36 Subject: [PATCH] Add coding header when notebook exported to .py file. Closes gh-1156 --- diff --git a/IPython/nbformat/v2/nbpy.py b/IPython/nbformat/v2/nbpy.py index 5cb5d2b..e49bf6b 100644 --- a/IPython/nbformat/v2/nbpy.py +++ b/IPython/nbformat/v2/nbpy.py @@ -111,7 +111,7 @@ class PyWriter(NotebookWriter): def writes(self, nb, **kwargs): lines = [] - lines.extend([u'# 2','']) + lines.extend([u'# coding: utf-8', u'# 2','']) for ws in nb.worksheets: for cell in ws.cells: if cell.cell_type == u'code':