diff options
author | Martin Geisler <martin@geisler.net> | 2013-08-28 09:46:09 +0200 |
---|---|---|
committer | Martin Geisler <martin@geisler.net> | 2013-08-28 09:58:18 +0200 |
commit | 66b2d23961b02b86e0ff26b3ffcb6405f7dcedf1 (patch) | |
tree | 99c6b4e3b22f26a48ecc8f21cc8bb7fa451d16d1 /test | |
parent | 10ca8d3a5b4e7b20a7b9be34c832ab1edb9bb6d7 (diff) | |
download | mako-66b2d23961b02b86e0ff26b3ffcb6405f7dcedf1.tar.gz |
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.
Diffstat (limited to 'test')
-rw-r--r-- | test/templates/chs_unicode.html | 2 | ||||
-rw-r--r-- | test/templates/chs_unicode_py3k.html | 2 | ||||
-rw-r--r-- | test/templates/chs_utf8.html | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/test/templates/chs_unicode.html b/test/templates/chs_unicode.html index 6e7c090..57fccdf 100644 --- a/test/templates/chs_unicode.html +++ b/test/templates/chs_unicode.html @@ -1,4 +1,4 @@ -## -*- encoding:utf8 -*- +## -*- coding:utf8 -*- <% msg = u'新中国的主席' %> diff --git a/test/templates/chs_unicode_py3k.html b/test/templates/chs_unicode_py3k.html index 35b888d..bffe330 100644 --- a/test/templates/chs_unicode_py3k.html +++ b/test/templates/chs_unicode_py3k.html @@ -1,4 +1,4 @@ -## -*- encoding:utf8 -*- +## -*- coding:utf8 -*- <% msg = '新中国的主席' %> diff --git a/test/templates/chs_utf8.html b/test/templates/chs_utf8.html index f9a7035..170d626 100644 --- a/test/templates/chs_utf8.html +++ b/test/templates/chs_utf8.html @@ -1,4 +1,4 @@ -## -*- encoding:utf8 -*- +## -*- coding:utf8 -*- <% msg = '新中国的主席' %> |