Skip to content
Browse files

Use emacs-recognised encoding declaration.

  • Loading branch information...
1 parent ce06224 commit 943a2321c26c0abc2fd5eb2e3616a514bf636597 @takluyver committed
Showing with 3 additions and 3 deletions.
  1. +2 −2 IPython/nbformat/v2/nbpy.py
  2. +1 −1 IPython/nbformat/v2/tests/nbexamples.py
View
4 IPython/nbformat/v2/nbpy.py
@@ -24,7 +24,7 @@
# Code
#-----------------------------------------------------------------------------
-_encoding_declaration_re = re.compile(r"^#\s*coding[:=]\s*([-\w.]+)")
+_encoding_declaration_re = re.compile(r"^#.*coding[:=]\s*([-\w.]+)")
class PyReaderError(Exception):
pass
@@ -113,7 +113,7 @@ def split_lines_into_blocks(self, lines):
class PyWriter(NotebookWriter):
def writes(self, nb, **kwargs):
- lines = [u'# coding: utf-8']
+ lines = [u'# -*- coding: utf-8 -*-']
lines.extend([u'# <nbformat>2</nbformat>',''])
for ws in nb.worksheets:
for cell in ws.cells:
View
2 IPython/nbformat/v2/tests/nbexamples.py
@@ -81,7 +81,7 @@
metadata=md
)
-nb0_py = """# coding: utf-8
+nb0_py = """# -*- coding: utf-8 -*-
# <nbformat>2</nbformat>
# <htmlcell>

0 comments on commit 943a232

Please sign in to comment.
Something went wrong with that request. Please try again.