[Python-3000] Pleaswe help with the countdown to zero failing tests in the struni branch!
"Martin v. Löwis"
martin at v.loewis.de
Wed Aug 8 09:04:45 CEST 2007
>> It's in Modules/timemodule.c, line 691:
>> PyModule_AddObject(m, "tzname",
>> Py_BuildValue("(zz)", tzname[0], tzname[1]));
>>
>> According to MSDN, tzname is a global variable; the contents is somehow
>> derived from the TZ environment variable (which is not set in my case).
>
> Is there anything from which you can guess the encoding (e.g. the
> filesystem encoding?).
It's in the locale's encoding. On Windows, that will be "mbcs"; on other
systems, the timezone names are typically all in ASCII - this would
allow for a quick work-around. Using the filesytemencoding would also
work, although it would be an equal hack: it's *meant* to be used only
for file names (and on OSX at least, it deviates from the locale's
encoding - although I have no idea what tzname is encoded in on OSX).
> These are all externally-provided strings. It will depend on the
> platform what the encoding is.
>
> I wonder if we need to add another format code to Py_BuildValue (and
> its friends) to designate "platform default encoding" instead of
> UTF-8.
For symmetry with ParseTuple, there could be the 'e' versions
(es, ez, ...) which would take a codec name also.
"platform default encoding" is a tricky concept, of course:
Windows alone has two of them on each installation.
Regards,
Martin
More information about the Python-3000
mailing list