diff options
author | Nobuyoshi Nakada <[email protected]> | 2024-12-06 16:56:29 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2024-12-06 18:59:38 +0900 |
commit | 1c15f641cc2bb88fa88123a11036ed58fbf9aa6d (patch) | |
tree | c7ab6a155e8f5c9eacaa46a5d99a24b338ffdefd /test | |
parent | 78762b52185aa80ee55c0d49b495aceed863dce2 (diff) |
[Bug #20929] Win32: Encode timezone name in UTF-8
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12269
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_time.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb index d4c91e1035..98e4c333a5 100644 --- a/test/ruby/test_time.rb +++ b/test/ruby/test_time.rb @@ -717,13 +717,15 @@ class TestTime < Test::Unit::TestCase assert_equal("2000-01-01 09:12:34 +091234", t2000.localtime(9*3600+12*60+34).inspect) end + FIXED_ZONE_ENCODING = (Encoding::UTF_8 if /mswin|mingw/.match?(RUBY_PLATFORM)) + def assert_zone_encoding(time) zone = time.zone assert_predicate(zone, :valid_encoding?) if zone.ascii_only? assert_equal(Encoding::US_ASCII, zone.encoding) else - enc = Encoding.find('locale') + enc = FIXED_ZONE_ENCODING || Encoding.find('locale') assert_equal(enc, zone.encoding) end end |