Compiler directives in the source  Skip Montanaro skip at Thu
Feb 6 17:12:30 CET 2003      Paul> Python could accept     Paul>
%encoding: -*- utf8 -*-     Paul> and then both Python and Emacs
could understand it.  Yes, but code containing such a cookie
wouldn't run on older versions of Python.  Sticking the encoding
information in a magic comment is a hack, everyone knows that,
but as has been repeated several times, there are some editors
which understand the cookie (it has to be comment-agnostic
because such cookies might be used for many types of files), and
embedding it in a comment keeps it from breaking old versions of
Python.   More information about the Python-list mailing list