We probably want to strip the encoding declaration out when we load a .py file, as well. I'll add that to this PR.
Add coding header when notebook exported to .py file.
Strip out encoding declaration when loading notebook.
Add encoding declaration to test for notebook -> .py export.
I think this should be done in two separate lines. Let' s not mix encoding with nbformat info. Instead, initialize the lines list with the encoding declaration:
lines = ['# coding: utf-8'']
# rest of the code as it was before this PR
Tweak to notebook -> .py export, at Fernando's suggestion.
Looks good to me, is there any benefit to # -*- coding: utf-8 -*- as Fernando originally suggested over # coding: utf-8 ?
# -*- coding: utf-8 -*-
# coding: utf-8
Use emacs-recognised encoding declaration.