Python and unicode

Dotan Cohen dotancohen at gmail.com
Mon Sep 20 05:35:03 EDT 2010


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
> language.
>
> See here for documentation on encoding declarations:
>
> http://docs.python.org/reference/lexical_analysis.html#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

http://gibberish.co.il
http://what-is-what.com



More information about the Python-list mailing list