[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2021-03-06 Thread Eryk Sun
Eryk Sun added the comment: The solution for bpo-36779 changed init_timezone() to get tzname directly from WinAPI GetTimeZoneInformation(). Unfortunately the implementer didn't think to also support time.tzset(), so the value may be stale with no way to refresh it, or possibly different fro

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2018-07-05 Thread Paul Ganssle
Change by Paul Ganssle : -- nosy: +p-ganssle ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyt

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2017-09-25 Thread Mark Lawrence
Changes by Mark Lawrence : -- nosy: -BreamoreBoy ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2017-09-25 Thread STINNER Victor
STINNER Victor added the comment: bpo-31549 has been marked as a duplicate of this issue. -- ___ Python tracker ___ ___ Python-bugs-l

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2017-09-25 Thread STINNER Victor
STINNER Victor added the comment: Formatting timezone on Windows in the right encoding is an old Python (especially Python 3) issue: https://bugs.python.org/issue1040 https://bugs.python.org/issue8304 https://bugs.python.org/issue10653 https://bugs.python.org/issue16322#msg174164 -- _

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2017-09-25 Thread Denis Osipov
Changes by Denis Osipov : -- keywords: +patch pull_requests: +3726 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-lis

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2015-09-22 Thread Petr Prikryl
Petr Prikryl added the comment: @eryksun: Thanks for your help. I have finaly ended with your... "Call setlocale(LC_CTYPE, ''), and then call time.strftime('%Z') to get the timezone name." -- ___ Python tracker _

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2015-09-21 Thread eryksun
eryksun added the comment: > import locale > locale.setlocale(locale.LC_ALL, '') > > import importlib > import time > importlib.reload(time) > > it does not work when imported after importing time. > What is the reason? Does reload() work only for > modules coded as Python sources? The import

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2015-09-21 Thread Petr Prikryl
Petr Prikryl added the comment: @eryksun: I see. In my case, I can set the locale before importing the time module. However, the code (asciidoc3.py) will be used as a module, and I cannot know if the user imported the time module or not. Instead of your suggestion result = result.encode('

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2015-09-21 Thread eryksun
eryksun added the comment: > local_encoding = locale.getdefaultlocale()[1] Use locale.getpreferredencoding(). > b = eval('b' + ascii(result)) > result = b.decode(local_encoding) It's simpler and more reliable to use 'latin-1' and 'mbcs' (ANSI). For example: result = result.encode('latin-1

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2015-09-19 Thread Petr Prikryl
Petr Prikryl added the comment: I have worked around a bit differently -- the snippet from the code: result = time.tzname[0]# simplified version of the original code. # Because of the bug in Windows libraries, Python 3.3 tried to work around # some issues. However, the shit hit

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2015-09-19 Thread eryksun
eryksun added the comment: To decode the tzname strings, Python calls mbstowcs, which on Windows uses Latin-1 in the "C" locale. However, in this locale the tzname strings are actually encoded using the system ANSI codepage (e.g. 1250 for Central/Eastern Europe). So it ends up decoding ANSI st

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2015-09-18 Thread Petr Prikryl
Petr Prikryl added the comment: I have just observed behaviour for the Czech locale. I tried to avoid collisions with stdout encoding, writing the strings into a file using UTF-8 encoding: tzname_bug.py -- #!python3 import time import sys with op

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2014-07-30 Thread Mark Lawrence
Mark Lawrence added the comment: Could somebody respond to the originator please. -- nosy: +BreamoreBoy versions: +Python 3.5 -Python 3.3 ___ Python tracker ___ _

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2012-11-26 Thread Masami HIRATA
Masami HIRATA added the comment: Is there any progress on this issue? -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsu

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2012-10-30 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: -serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http:

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2012-10-29 Thread STINNER Victor
STINNER Victor added the comment: "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

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2012-10-29 Thread STINNER Victor
STINNER Victor added the comment: According to CRT source code: - tzset() uses WideCharToMultiByte(lc_cp, 0, tzinfo.StandardName, -1, tzname[0], _TZ_STRINGS_SIZE - 1, NULL, &defused) with lc_cp = ___lc_codepage_func(). - wcsftime("%z") and wcsftime("%Z") use _mbstowcs_s_l() to decode the time

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2012-10-29 Thread STINNER Victor
STINNER Victor added the comment: See also the issue #836035. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2012-10-27 Thread Jesús Cea Avión
Changes by Jesús Cea Avión : -- nosy: +jcea ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2012-10-26 Thread Masami HIRATA
Masami HIRATA added the comment: > And what is the value.of locale.getpreferredencoding(False)? >>> import locale >>> locale.getpreferredencoding(False) 'cp932' >>> -- ___ Python tracker __

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2012-10-26 Thread STINNER Victor
STINNER Victor added the comment: > >>> sys.getfilesystemencoding() > 'mbcs' > >>> import locale > >>> locale.getpreferredencoding() > 'cp932' > >>> > > 'cp932' is the same as 'mbcs' in the Japanese environment. And what is the value.of locale.getpreferredencoding(False)? -- __

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2012-10-25 Thread Masami HIRATA
Masami HIRATA added the comment: > What show sys.getdefaultencoding(), sys.getfilesystemencoding(), and > locale.getpreferredencoding()? C:\Python33>python.exe Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (In tel)] on win32 Type "help", "copyright", "credits" or

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2012-10-25 Thread STINNER Victor
STINNER Victor added the comment: >I see in 3.3 PyUnicode_DecodeFSDefaultAndSize() was replaced > by PyUnicode_DecodeLocale(). Related changes: - 8620e6901e58 for the issue #5905 - 279b0aee0cfb for the issue #13560 I wrote 8620e6901e58 for Linux, when the wcsftime() function is missing. The

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2012-10-25 Thread R. David Murray
Changes by R. David Murray : -- nosy: +belopolsky, haypo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http:/

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2012-10-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: As I understand, OP has UTF-8 locale. -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2012-10-25 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: Looking at the CRT source code, tznames should be decoded with mbcs. See also http://mail.python.org/pipermail/python-3000/2007-August/009290.html -- nosy: +amaury.forgeotdarc ___ Python tracker

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2012-10-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I see in 3.3 PyUnicode_DecodeFSDefaultAndSize() was replaced by PyUnicode_DecodeLocale(). What show sys.getdefaultencoding(), sys.getfilesystemencoding(), and locale.getpreferredencoding()? -- components: +Extension Modules keywords: +3.3regression

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2012-10-25 Thread Masami HIRATA
New submission from Masami HIRATA: OS: Windows 7 Starter Edition SP1 (32-bit) Japanese version Python: 3.3.0 for Windows x86 (python-3.3.0.msi) time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding. C:\Python33>python.exe Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48)