ruby-changes:37638
From: naruse <ko1@a...>
Date: Tue, 24 Feb 2015 17:43:09 +0900 (JST)
Subject: [ruby-changes:37638] naruse:r49719 (ruby_2_2): merge revision(s) 49693, 46907, 49702, 49710: [Backport #10887]
naruse 2015-02-24 17:42:52 +0900 (Tue, 24 Feb 2015) New Revision: 49719 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49719 Log: merge revision(s) 49693,46907,49702,49710: [Backport #10887] * 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. * time.c (time_zone_name): should be US-ASCII only if all 7-bits, otherwise locale encoding. [ruby-core:68230] [Bug #10887] * time.c (time_zone_name): should be US-ASCII only if all 7-bits, otherwise locale encoding. [ruby-core:68230] [Bug #10887] Modified directories: branches/ruby_2_2/ Modified files: branches/ruby_2_2/ChangeLog branches/ruby_2_2/test/ruby/test_time.rb branches/ruby_2_2/test/ruby/test_time_tz.rb branches/ruby_2_2/time.c branches/ruby_2_2/version.h Index: ruby_2_2/time.c =================================================================== --- ruby_2_2/time.c (revision 49718) +++ ruby_2_2/time.c (revision 49719) @@ -4198,6 +4198,9 @@ time_zone_name(const char *zone) https://github.com/ruby/ruby/blob/trunk/ruby_2_2/time.c#L4198 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; } Index: ruby_2_2/ChangeLog =================================================================== --- ruby_2_2/ChangeLog (revision 49718) +++ ruby_2_2/ChangeLog (revision 49719) @@ -1,3 +1,19 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1 +Tue Feb 24 17:41:27 2015 Nobuyoshi Nakada <nobu@r...> + + * 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@r...> + + * 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@g...> + + * 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@r...> * string.c (chompped_length): enable smart chomp for all non-dummy Index: ruby_2_2/version.h =================================================================== --- ruby_2_2/version.h (revision 49718) +++ ruby_2_2/version.h (revision 49719) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1 #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 Index: ruby_2_2/test/ruby/test_time.rb =================================================================== --- ruby_2_2/test/ruby/test_time.rb (revision 49718) +++ ruby_2_2/test/ruby/test_time.rb (revision 49719) @@ -527,9 +527,12 @@ class TestTime < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/ruby/test_time.rb#L527 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 Index: ruby_2_2/test/ruby/test_time_tz.rb =================================================================== --- ruby_2_2/test/ruby/test_time_tz.rb (revision 49718) +++ ruby_2_2/test/ruby/test_time_tz.rb (revision 49719) @@ -267,6 +267,7 @@ class TestTimeTZ < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/ruby/test_time_tz.rb#L267 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) } } } Property changes on: ruby_2_2 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r49693,49702,49710 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/