DeprecationWarning: Non-ASCII character '\xc0'

"Martin v. Löwis" martin at v.loewis.de
Sat Feb 7 03:24:22 EST 2004


ahsan Imam wrote:
> I am not sure what encoding to use. I am not sure where to look. I
> picked one out of the documentation.

I recommend you avoid using non-ASCII characters in source code in
this specific case.

>     'À':'A', '<\\\#203>':'A', 'À':'A', 'À':'A',

Here, À is a non-ASCII character. If you copy-and-past this
to a Python session, and do

 >>> ord("À")
192

you find that it really is the character with the byte value
192. So reformulate the line above to

      'À':'A', '<\\\#203>':'A', 'À':'A', chr(192):'A',

If you change all lines in this respect, you won't need an
encoding declaration anymore, as your source code is plain ASCII.

Regards,
Martin




More information about the Python-list mailing list