[Python-Dev] Source encoding doubt

Gustavo Niemeyer niemeyer at conectiva.com
Sun Feb 15 19:47:36 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?

# -*- 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')

Gustavo Niemeyer

More information about the Python-Dev mailing list