diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | string.c | 2 | ||||
-rw-r--r-- | test/ruby/test_m17n.rb | 6 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 14 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Mon Nov 22 11:58:11 2010 NARUSE, Yui <naruse@ruby-lang.org> + + * 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@yahoo.co.jp> * common.mk: add dependency(insns.inc) to compile.obj @@ -2026,6 +2026,8 @@ rb_str_concat(VALUE str1, VALUE str2) } 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; } diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index 3682d09898..3a71bd9bf0 100644 --- a/test/ruby/test_m17n.rb +++ b/test/ruby/test_m17n.rb @@ -1093,6 +1093,12 @@ class TestM17N < Test::Unit::TestCase 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) @@ -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 |