Unicode entries on sys.path

Thomas Heller theller at python.net
Mon Dec 27 10:55:00 EST 2004


"Martin v. Löwis" <martin at v.loewis.de> writes:

> Thomas Heller wrote:
>> It seems that Python itself converts unicode entries in sys.path to
>> normal strings using windows default conversion rules - is this a
>> problem that I can fix by changing some regional setting on my machine?
>
> You can set the system code page on the third tab on the XP
> regional settings (character set for non-unicode applications).
> This, of course, assumes that there is a character set that supports
> all directories in sys.path. If you have Japanese characters on
> sys.path, you certainly need to set the system locale to Japanese
> (is that CP932?).
>
> Changing this setting requires a reboot.
>
>> Hm, maybe more a windows question than a python question...
>
> The real question here is: why does Python not support arbitrary
> Unicode strings on sys.path? It could, in principle, atleast on
> Windows NT+ (and also on OSX). Patches are welcome.

How should these patches be approached?  On windows, it would probably
be easiest to use the MS generic text routines: _tcslen instead of
strlen, for example, and to rely on the _UNICODE preprocessor symbol to
map this function to strlen or wcslen.  Is there a similar thing in the
non-windows world?

Thomas



More information about the Python-list mailing list