Skip to content

Commit 34098b6

Browse files
committed
[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.
1 parent 556be73 commit 34098b6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

time.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,13 @@ zone_str(const char *zone)
999999
str = rb_usascii_str_new(zone, len);
10001000
}
10011001
else {
1002+
#ifdef _WIN32
1003+
str = rb_utf8_str_new(zone, len);
1004+
/* until we move to UTF-8 on Windows completely */
1005+
str = rb_str_export_locale(str);
1006+
#else
10021007
str = rb_enc_str_new(zone, len, rb_locale_encoding());
1008+
#endif
10031009
}
10041010
return rb_fstring(str);
10051011
}

0 commit comments

Comments
 (0)