You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
time.tzname returns empty string on Windows if default codepage is a Unicode codepage #80960
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2019-06-12.23:54:23.769>created_at=<Date2019-05-03.00:45:22.319>labels= ['3.8', 'type-bug', '3.7', 'OS-windows']
title='time.tzname returns empty string on Windows if default codepage is a Unicode codepage'updated_at=<Date2021-03-08.18:25:28.786>user='https://github.com/paulmon'
Need to work around a CRT bug in the use of _tzset() + _tzname[]
Calling setlocale(LC_CTYPE, "") on a system where GetACP() returns CP_UTF8 results in empty strings in _tzname[].
This causes time.tzname to be an empty string.
I have reported the bug.
One possible workaround is to temporarily change the locale by calling setlocale(LC_CTYPE, "C") before calling _tzset and restore the current locale after if the GetACP() == CP_UTF8 or CP_UTF7
changed the title [-]strptime returns empty string on Windows if default codepage is a Unicode codepage[/-][+]time.tzname returns empty string on Windows if default codepage is a Unicode codepage[/+]on May 3, 2019
New changeset b4c7def by Miss Islington (bot) (Paul Monson) in branch 'master': bpo-36779: time.tzname returns empty string on Windows if default cod… (GH-13073) b4c7def
New changeset 0a9baec by Victor Stinner (Miss Islington (bot)) in branch '3.8': bpo-36779: time.tzname returns empty string on Windows if default cod… (GH-13073) (GH-14032) 0a9baec
New changeset 6a433f5 by Miss Islington (bot) in branch '3.7': bpo-36779: time.tzname returns empty string on Windows if default cod… (GH-13073) 6a433f5
Activity
paulmon commentedon May 3, 2019
Need to work around a CRT bug in the use of _tzset() + _tzname[]
Calling setlocale(LC_CTYPE, "") on a system where GetACP() returns CP_UTF8 results in empty strings in _tzname[].
This causes time.tzname to be an empty string.
I have reported the bug.
One possible workaround is to temporarily change the locale by calling setlocale(LC_CTYPE, "C") before calling _tzset and restore the current locale after if the GetACP() == CP_UTF8 or CP_UTF7
[-]strptime returns empty string on Windows if default codepage is a Unicode codepage[/-][+]time.tzname returns empty string on Windows if default codepage is a Unicode codepage[/+]matrixise commentedon May 22, 2019
Hi Paul,
I have added your PR at this issue, it was assigned to another bpo issue.
miss-islington commentedon Jun 12, 2019
New changeset b4c7def by Miss Islington (bot) (Paul Monson) in branch 'master':
bpo-36779: time.tzname returns empty string on Windows if default cod… (GH-13073)
b4c7def
vstinner commentedon Jun 13, 2019
New changeset 0a9baec by Victor Stinner (Miss Islington (bot)) in branch '3.8':
bpo-36779: time.tzname returns empty string on Windows if default cod… (GH-13073) (GH-14032)
0a9baec
miss-islington commentedon Jun 13, 2019
New changeset 6a433f5 by Miss Islington (bot) in branch '3.7':
bpo-36779: time.tzname returns empty string on Windows if default cod… (GH-13073)
6a433f5