From: "YO4 (Yoshinao Muramatsu) via ruby-core" Date: 2024-12-06T10:19:55+00:00 Subject: [ruby-core:120117] [Ruby master Bug#20929] TestTime have an assertion different from current implementation. Issue #20929 has been updated by YO4 (Yoshinao Muramatsu). Thank you for your response. Regarding Time#zone encoding, I am experimenting with it in my branch https://github.com/YO4/ruby/tree/tzname_utf8. I found this issue in my research for that. At present, the change to utf-8 causes the following error. ``` >ruby -e 'puts "������������������:#{Time.now.zone}"' -e:1:in '
': incompatible character encodings: Windows-31J and UTF-8 (Encoding::CompatibilityError) ``` To resolve this, other strings must also be in UTF-8 encoding. I think it would be preferred that strings with Unicode code ranges also have UTF-8 encoding. OS-derived strings, excluding I/O content, seem to meet that requirement. Of course, this matter should be discussed in another issue. Thanks. ---------------------------------------- Bug #20929: TestTime have an assertion different from current implementation. https://bugs.ruby-lang.org/issues/20929#change-110869 * Author: YO4 (Yoshinao Muramatsu) * Status: Closed * Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- test/ruby/test_time.rb have following assersion function. ```ruby 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.default_internal || Encoding.find('locale') assert_equal(enc, zone.encoding) end end ``` In current implementation, Time#zone are returned in US_ASCII or locale encoding, which does not seem to take into account the default_internal. ``` C:\>ruby -e "puts Time.now.zone" ������ (���������) C:\>ruby -e "puts Time.now.zone.encoding" Windows-31J C:\>ruby -EWindows-31J:UTF-8 -e "puts Time.now.zone" ������ (���������) C:\>ruby -EWindows-31J:UTF-8 -e "puts Time.now.zone.encoding" Windows-31J ``` -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/