strxfrm works with unicode string ?

Magnus Lycka lycka at carmen.se
Tue Jun 21 04:34:41 EDT 2005


nicolas.riesch at genevoise.ch wrote:
> Gruëzi, Gerald ;-)
> 
> Well, ok, but I don't understand why I should first convert a pure
> unicode string into a byte string.
> The encoding ( here, latin-1) seems an arbitrary choice.

Yes. The correct choice would be 'cp1252', not 'latin-1',
since that's what your locale setting indicates.

It seems to me that Python is on a journey from the ASCII
world to the Unicode world, and it will take a few more
versions before it gets there. Going from 2.2 to 2.3 was
a bumpy part of the ride, and it's still not smooth.

Just try to use raw_input with national characters. As far
as I remember it hasn't worked (on windows at least) since
2.2.

The clear improvement from 2.3 is that if you print unicode
strings to stdout, they will look correct both in the GUI
and in text mode (cmd.exe). That never worked before since
Windows use different code pages in Windows and in the text
mode (which is supposed to be DOS compatible).



More information about the Python-list mailing list