String methods understanding anything but ASCII?
Irmen de Jong
irmen at NOSPAM-REMOVETHIS-xs4all.nl
Sun Jan 19 16:24:04 EST 2003
Magnus Lie Hetland wrote:
> I just wondered -- is there hope that string methods such as upper()
> or capitalize() will ever understand anything other than ascii? How
> about, e.g. iso8859-1 (which does seem to be the default encoding)? As
> a Scandinavian, I'd love to see 'ø'.upper() == 'Ø', for example.
>>> print unicode('ø','cp1252').upper().encode('cp1252')
Ø
You should use the unicode functions to perform operations on
non-ascii characters.
Irmen
More information about the Python-list
mailing list