{{ message }}
tzdb.cpp: Fall back to numeric offset when the current code page cannot represent the time zone short ID#5558
Merged
Merged
Conversation
StephanTLavavej
approved these changes
Jun 3, 2025
Member
Closed
Member
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
Member
|
Thanks for figuring out how to fix this in a reasonable way! 😻 🗺️ 🕥 |
TheStormN
reviewed
Jun 16, 2025
Contributor
There was a problem hiding this comment.
Sorry for commenting after a merge, but does this release() call means we are leaking memory?
Contributor
Author
There was a problem hiding this comment.
We aren't leaking memory. The returned __std_tzdb_sys_info* will be stored in a unique_ptr<__std_tzdb_sys_info, _Tzdb_deleter<__std_tzdb_sys_info>>, which will call __std_tzdb_delete_sys_info in its destructor, which will perform delete[] _Info->_Abbrev;
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This PR adds a fallback time zone abbreviation of the form
-05or+0530when the system's code page cannot represent the localized time zone short ID produced by ICU. Previously such time zone short ID would result inERROR_NO_UNICODE_TRANSLATIONexceptions.The numeric offset form (
-05or+0530) is chosen because it is similar to the time zone abbreviation intzdb, and distinguishable from ICU's output.The behavior depends on the current user locale and the current code page. For ICU 77.1, the following locales have time zone short ID with non-ASCII characters, and thus might be affected by this fallback:
am,ar,as,bg,blo,brx,ckb,cs,dz,fa,ff_Adlm,ga,gd,he,hi,ii,km,ks,ks_Deva,ku,mai,ml,mni,nqo,sa,sat,sd,sd_Deva,si,sk,vi,xnr. In addition, the following locales have non-ASCII character (U+2212 or U+2013) as the minus sign, and thus are also affected:et,eu,fa,fr,lij,lt,se,sv.No tests are added because the
enlocale is unaffected.Fixes #3158
Fixes #5482