Python and unicode

Dotan Cohen dotancohen at
Mon Sep 20 11:35:03 CEST 2010

On Mon, Sep 20, 2010 at 05:42, Steven D'Aprano
<steve at> wrote:
>> Use the PEP 263 encoding
>> declaration <URL:> 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
> language.
> 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
3? 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).

Dotan Cohen

More information about the Python-list mailing list