##// END OF EJS Templates
Use emacs-recognised encoding declaration.
Thomas Kluyver -
Show More
@@ -24,7 +24,7 b' from .nbbase import new_code_cell, new_text_cell, new_worksheet, new_notebook'
24 # Code
24 # Code
25 #-----------------------------------------------------------------------------
25 #-----------------------------------------------------------------------------
26
26
27 _encoding_declaration_re = re.compile(r"^#\s*coding[:=]\s*([-\w.]+)")
27 _encoding_declaration_re = re.compile(r"^#.*coding[:=]\s*([-\w.]+)")
28
28
29 class PyReaderError(Exception):
29 class PyReaderError(Exception):
30 pass
30 pass
@@ -113,7 +113,7 b' class PyReader(NotebookReader):'
113 class PyWriter(NotebookWriter):
113 class PyWriter(NotebookWriter):
114
114
115 def writes(self, nb, **kwargs):
115 def writes(self, nb, **kwargs):
116 lines = [u'# coding: utf-8']
116 lines = [u'# -*- coding: utf-8 -*-']
117 lines.extend([u'# <nbformat>2</nbformat>',''])
117 lines.extend([u'# <nbformat>2</nbformat>',''])
118 for ws in nb.worksheets:
118 for ws in nb.worksheets:
119 for cell in ws.cells:
119 for cell in ws.cells:
@@ -81,7 +81,7 b' nb0 = new_notebook('
81 metadata=md
81 metadata=md
82 )
82 )
83
83
84 nb0_py = """# coding: utf-8
84 nb0_py = """# -*- coding: utf-8 -*-
85 # <nbformat>2</nbformat>
85 # <nbformat>2</nbformat>
86
86
87 # <htmlcell>
87 # <htmlcell>
General Comments 0
You need to be logged in to leave comments. Login now