Message174165
"Instead of trying to bet what is the correct encoding, it would be simpler (and safer) to read the Unicode version of the tzname array: StandardName and DaylightName of GetTimeZoneInformation()."
GetTimeZoneInformation() formats correctly timezone names, but it reintroduces #10653 issue: time.strftime("%Z") formats the timezone name differently.
See also issue #13029 which is a duplicate of #10653, but contains useful information.
--
Example on Windows 7 with a french setup configured to Tokyo's timezone.
Using GetTimeZoneInformation(), time.tzname is ("Tokyo", "Tokyo (heure d\u2019\xe9t\xe9)"). U+2019 is the "RIGHT SINGLE QUOTATION MARK". This character is usually replaced with U+0027 (APOSTROPHE) in ASCII.
time.strftime("%Z") gives "Tokyo (heure d'\x81\x66ete)" (if it is implemented using strftime() or wcsftime()).
--
If I understood correctly, Python 3.3 has two issues on Windows:
* time.tzname is decoded from the wrong encoding
* time.strftime("%Z") gives an invalid output
The real blocker issue is a bug in strftime() and wcsftime() in Windows CRT. A solution is to replace "%Z" with the timezone name before calling strftime() or wcsftime(), aka working around the Windows CRT bug. |
|
Date |
User |
Action |
Args |
2012-10-30 00:28:26 | vstinner | set | recipients:
+ vstinner, jcea, amaury.forgeotdarc, belopolsky, ocean-city, serhiy.storchaka, msmhrt |
2012-10-30 00:28:26 | vstinner | set | messageid: <1351556906.15.0.348554843083.issue16322@psf.upfronthosting.co.za> |
2012-10-30 00:28:26 | vstinner | link | issue16322 messages |
2012-10-30 00:28:25 | vstinner | create | |
|