ruby-changes:18239
From: yugui <ko1@a...>
Date: Mon, 20 Dec 2010 22:30:28 +0900 (JST)
Subject: [ruby-changes:18239] Ruby:r30261 (ruby_1_9_2): merges r29848 and r29852 from trunk into ruby_1_9_2.
yugui 2010-12-20 22:22:48 +0900 (Mon, 20 Dec 2010) New Revision: 30261 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30261 Log: merges r29848 and r29852 from trunk into ruby_1_9_2. -- * string.c (rb_str_concat): set ENC_CODERANGE_VALID when the receiver is 7BIT and the argument is non ASCII. -- Fix r29848's test. Modified files: branches/ruby_1_9_2/ChangeLog branches/ruby_1_9_2/string.c branches/ruby_1_9_2/test/ruby/test_m17n.rb branches/ruby_1_9_2/version.h Index: ruby_1_9_2/ChangeLog =================================================================== --- ruby_1_9_2/ChangeLog (revision 30260) +++ ruby_1_9_2/ChangeLog (revision 30261) @@ -1,3 +1,8 @@ +Mon Nov 22 11:58:11 2010 NARUSE, Yui <naruse@r...> + + * string.c (rb_str_concat): set ENC_CODERANGE_VALID when the + receiver is 7BIT and the argument is non ASCII. + Sat Nov 20 01:57:55 2010 Akio Tajima <artonx@y...> * common.mk: add dependency(insns.inc) to compile.obj Index: ruby_1_9_2/string.c =================================================================== --- ruby_1_9_2/string.c (revision 30260) +++ ruby_1_9_2/string.c (revision 30261) @@ -2026,6 +2026,8 @@ } rb_str_resize(str1, pos+len); rb_enc_mbcput(lc, RSTRING_PTR(str1)+pos, enc); + if (cr == ENC_CODERANGE_7BIT && lc > 127) + cr = ENC_CODERANGE_VALID; ENC_CODERANGE_SET(str1, cr); return str1; } Index: ruby_1_9_2/version.h =================================================================== --- ruby_1_9_2/version.h (revision 30260) +++ ruby_1_9_2/version.h (revision 30261) @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 101 +#define RUBY_PATCHLEVEL 102 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 Index: ruby_1_9_2/test/ruby/test_m17n.rb =================================================================== --- ruby_1_9_2/test/ruby/test_m17n.rb (revision 30260) +++ ruby_1_9_2/test/ruby/test_m17n.rb (revision 30261) @@ -1093,6 +1093,12 @@ assert_equal(a, s.each_char.to_a, "[ruby-dev:33211] #{encdump s}.each_char.to_a") end + def test_str_concat + assert_equal(1, "".concat(0xA2).size) + assert_equal("A\x84\x31\xA4\x39".force_encoding("GB18030"), + "A".force_encoding("GB18030") << 0x8431A439) + end + def test_regexp_match assert_equal([0,0], //.match("\xa1\xa1".force_encoding("euc-jp"),-1).offset(0)) assert_equal(0, // =~ :a) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/