[Python-Dev] Re: Source encoding doubt

Gustavo Niemeyer niemeyer at conectiva.com
Sun Feb 15 20:11:48 EST 2004


> I'm wondering what I misunderstood in PEP263. In the following example,
> shouldn't it work correctly, showing 'áéíóú', as far as my terminal
> accepts ISO-8859-1?
> 
> #!/usr/bin/python
> # -*- coding: utf-8 -*-
> s1 =  "\xc3\xa1\xc3\xa9\xc3\xad\xc3\xb3\xc3\xba"
> s2 = u"\xc3\xa1\xc3\xa9\xc3\xad\xc3\xb3\xc3\xba"
> print s1.encode('iso-8859-1')
> print s2.encode('iso-8859-1')

Argh.. ok, understood. I need some sleep. These strings are not unicode,
but escapings of unicode strings.

-- 
Gustavo Niemeyer
http://niemeyer.net



More information about the Python-Dev mailing list