Problem with national characters
Max M
maxm at mxm.dk
Thu Mar 31 18:06:14 EST 2005
Leif B. Kristensen wrote:
> Is there a way around this problem? My character set in Linux is
> ISO-8859-1. In Windows 2000 it should be the equivavent Latin-1, though
> I'm not sure about which character set the command shell is using.
The unicode methods seems to do it correctly. So you can decode your
strings as unicode, do the transfom, and encode it back as latin1.
print repr('før'.decode('latin-1').upper().encode('latin-1')) #
'F\xd8R'
print repr('FØR'.decode('latin-1').encode('latin-1'))
'F\xd8R'
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
More information about the Python-list
mailing list