Use Emacs-friendly file variable to set file encoding

The file encoding line serves a dual purpose: it informs both Python
and Emacs about the file encoding.

PEP 263 explains that a file with non-ASCII characters must specify an
encoding. Without an encoding line, importing the file will raise a
SyntaxError.

The problem is now that while Python will accept both of

  -*- encoding: <some-encoding> -*-
  -*- coding: <some-encoding> -*-

and Emacs only accepts the latter since it looks for a file variable
named "coding", not "encoding". Since the Emacs specific "-*-" syntax
is already used, it seems right to use the correct variable for Emacs.

Change-Id: If5321ac2fad595c529aa3ec5f2852aa71458834b
This commit is contained in:
Martin Geisler 2014-05-27 21:12:03 +02:00
parent 0f9e4a16ba
commit f1b1555f58
1 changed files with 1 additions and 1 deletions

View File

@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
#
# Copyright © 2013 Unitedstack Inc.
#