Use "coding:" instead of "encoding:" to specify file encoding
Using "-*- encoding:utf-8 -*-" doesn't really set the file encoding
for Emacs. It will even prompt the user when opening a compiled file:
The local variables list in foo.mak.py
contains values that may not be safe (*).
Do you want to apply it? You can type
y -- to apply the local variables list.
n -- to ignore the local variables list.
! -- to apply the local variables list, and permanently mark these
values (*) as safe (in the future, they will be set automatically.)
* encoding: utf-8
The problem is that Emacs looks for a file variable named "coding" and
it doesn't know about "encoding":
http://www.gnu.org/software/emacs/manual/html_node/emacs/Specify-Coding.html
This is no doubt why Python recognizes "coding:" by itself:
http://www.python.org/dev/peps/pep-0263/
This change makes the code generator output "# -*- coding:%s -*-" and
updates the documentation and examples to match this style.
5 files changed