Python and unicode
__peter__ at web.de
Mon Sep 20 12:20:34 CEST 2010
Dotan Cohen wrote:
> On Mon, Sep 20, 2010 at 05:42, Steven D'Aprano
> <steve at remove-this-cybersource.com.au> wrote:
>>> Use the PEP 263 encoding
>>> declaration <URL:http://www.python.org/dev/peps/pep-0263/> to let Python
>>> know the encoding of the program source file.
>> While PEPs are valuable, once accepted or rejected they become historical
>> documents. They don't necessarily document the current behaviour of the
>> See here for documentation on encoding declarations:
> This is the first time that I've read the PEP document regarding
> Unicode / UTF-8. I see that it mentions that the declaration must be
> on the second or first line of the file. Is this still true in Python
> I have been putting it further down (still before all python code,
> but after some comments) in code that I write (for my own use, not
> commercial code).
It may work by accident, if you declare it as UTF-8, because that is also
the default in Python 3.
More information about the Python-list