diff options
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | test/ruby/test_time.rb | 9 | ||||
-rw-r--r-- | test/ruby/test_time_tz.rb | 1 | ||||
-rw-r--r-- | time.c | 3 | ||||
-rw-r--r-- | version.h | 2 |
5 files changed, 27 insertions, 4 deletions
@@ -1,3 +1,19 @@ +Tue Feb 24 17:41:27 2015 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * time.c (time_zone_name): should be US-ASCII only if all 7-bits, + otherwise locale encoding. [ruby-core:68230] [Bug #10887] + +Tue Feb 24 17:41:27 2015 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * time.c (time_zone_name): should be US-ASCII only if all 7-bits, + otherwise locale encoding. [ruby-core:68230] [Bug #10887] + +Tue Feb 24 17:41:27 2015 Benoit Daloze <eregontp@gmail.com> + + * time.c: Zone encoding should be US-ASCII if all 7-bits. Fix r46907. + + * test/ruby/test_time.rb, test/ruby/test_time_tz.rb: Update tests. + Tue Feb 24 16:37:26 2015 Nobuyoshi Nakada <nobu@ruby-lang.org> * string.c (chompped_length): enable smart chomp for all non-dummy diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb index d0ded0ddf2..f4fb5bf3b3 100644 --- a/test/ruby/test_time.rb +++ b/test/ruby/test_time.rb @@ -527,9 +527,12 @@ class TestTime < Test::Unit::TestCase def assert_zone_encoding(time) zone = time.zone assert_predicate(zone, :valid_encoding?) - return if zone.ascii_only? - enc = Encoding.default_internal || Encoding.find('locale') - assert_equal(enc, zone.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 def test_zone diff --git a/test/ruby/test_time_tz.rb b/test/ruby/test_time_tz.rb index 6f3e05f4cc..fb1ab9b7c8 100644 --- a/test/ruby/test_time_tz.rb +++ b/test/ruby/test_time_tz.rb @@ -267,6 +267,7 @@ class TestTimeTZ < Test::Unit::TestCase assert_equal(format_gmtoff(gmtoff), t.strftime("%z")) assert_equal(format_gmtoff(gmtoff, true), t.strftime("%:z")) assert_equal(format_gmtoff2(gmtoff), t.strftime("%::z")) + assert_equal(Encoding::US_ASCII, t.zone.encoding) } } } @@ -4198,6 +4198,9 @@ time_zone_name(const char *zone) if (!rb_enc_str_asciionly_p(name)) { name = rb_external_str_with_enc(name, rb_locale_encoding()); } + else { + rb_enc_associate(name, rb_usascii_encoding()); + } return name; } @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.2.0" #define RUBY_RELEASE_DATE "2015-02-24" -#define RUBY_PATCHLEVEL 81 +#define RUBY_PATCHLEVEL 82 #define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_MONTH 2 |