[Python-Dev] PEP 263 -- Python Source Code Encoding

Martin v. Loewis martin@v.loewis.de
26 Feb 2002 19:00:22 +0100


Guido van Rossum <guido@python.org> writes:

> That looks OK to me.  I the Emacs-style comment in fact compatible
> with Emacs?

It is. I expect many people want to put "utf-8" as the encoding name,
and you need Emacs 21 for that (or Emacs with Mule-UCS, or some such).

In GNU Emacs, you see the effect of the coding: directive in the Emacs
status line. Just try the attached file, it will indicate "R" for
KOI8-R. Not sure about XEmacs.


Content-Type: application/octet-stream
Content-Disposition: attachment; filename=foo.py
Content-Transfer-Encoding: quoted-printable

#! /usr/bin/python
# -*- coding: koi8-r -*-

print "=ED=C1=D2=D4=C9=CE"