[Python-checkins] r53084 - peps/trunk/pep-0263.txt
georg.brandl
python-checkins at python.org
Tue Dec 19 22:04:02 CET 2006
Author: georg.brandl
Date: Tue Dec 19 22:04:01 2006
New Revision: 53084
Modified:
peps/trunk/pep-0263.txt
Log:
Clarify encoding cookie format.
Modified: peps/trunk/pep-0263.txt
==============================================================================
--- peps/trunk/pep-0263.txt (original)
+++ peps/trunk/pep-0263.txt Tue Dec 19 22:04:01 2006
@@ -47,17 +47,26 @@
To define a source code encoding, a magic comment must
be placed into the source files either as first or second
- line in the file:
+ line in the file, such as:
+
+ # coding=<encoding name>
+
+ or (using formats recognized by popular editors)
#!/usr/bin/python
# -*- coding: <encoding name> -*-
+ or
+
+ #!/usr/bin/python
+ # vim: set fileencoding=<encoding name> :
+
More precisely, the first or second line must match the regular
expression "coding[:=]\s*([-\w.]+)". The first group of this
expression is then interpreted as encoding name. If the encoding
is unknown to Python, an error is raised during compilation. There
must not be any Python statement on the line that contains the
- encoding declartation.
+ encoding declaration.
To aid with platforms such as Windows, which add Unicode BOM marks
to the beginning of Unicode files, the UTF-8 signature
More information about the Python-checkins
mailing list