diff options
author | Nobuyoshi Nakada <[email protected]> | 2025-02-20 15:34:25 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2025-02-20 15:34:32 +0900 |
commit | 34098b669c0cbc024cd08e686891f1dfe0a10aaf (patch) | |
tree | df59b2b32efbde987f48179ad0f67be9605843fa /time.c | |
parent | 556be73cbbf3845c448ca4f546411be18d523f33 (diff) |
[Bug #21144] Win32: Convert the time zone name to the current locale
The Windows time zone IDs provided by Microsoft as of 24H1 are ASCII
only all, but the API itself is not impossible to set non-ASCII key
name. Prefer the current locale encoding for now until we move to
UTF-8 including environment variables and command line arguments.
Diffstat (limited to 'time.c')
-rw-r--r-- | time.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -999,7 +999,13 @@ zone_str(const char *zone) str = rb_usascii_str_new(zone, len); } else { +#ifdef _WIN32 + str = rb_utf8_str_new(zone, len); + /* until we move to UTF-8 on Windows completely */ + str = rb_str_export_locale(str); +#else str = rb_enc_str_new(zone, len, rb_locale_encoding()); +#endif } return rb_fstring(str); } |