python3 - the hardest hello world ever ?

pjacobi.de at googlemail.com pjacobi.de at googlemail.com
Tue Oct 14 08:41:40 EDT 2008


Hi Helmut, All,


> do I miss something (I do hope so) or is switching to Python3
> really hard for Latin1-users?

It's as complicated as ever -- if you have used unicode strings
in the past (as the 3.0 strings now are always unicode strings).

> # sys.setfilesystemencoding('latin1')
This cares about the character encoding in filenames, not
in file content.

sys.setdefaultencoding('iso-8859-1') # or 'latin1'
would do the job, but only in sitecustomize.py. After
initializing, the function is no longer available.

And using it in sitecustomize.py is sort of discouraged.

IMHO the assumptions the typical Python installation makes
about the character encoding used in the system are much too
conservative. E.g. under Windows it should it use
GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_IDEFAULTANSICODEPAGE, ...).

Then a lot of things would work out of the box. Of course
including some methods to shoot yourself in the foot, which
you are prevented from by the current behaviour.


Regards,
Peter



More information about the Python-list mailing list