diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-11-22 03:01:45 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-11-22 03:01:45 +0000 |
commit | 3002e5e1f9767e914ccd3e1fcfd96b38b1fd438f (patch) | |
tree | 6fb0d5343a6659dd0c0fe75b4f4837b0bc926e28 | |
parent | d9615bf9c54414906ea9bac51f2a6e7ffd10c5cf (diff) | |
download | ruby-3002e5e1f9767e914ccd3e1fcfd96b38b1fd438f.tar.gz |
* string.c (rb_str_concat): set ENC_CODERANGE_VALID when the
receiver is 7BIT and the argument is non ASCII.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | string.c | 2 | ||||
-rw-r--r-- | test/ruby/test_m17n.rb | 1 |
3 files changed, 8 insertions, 0 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. + Mon Nov 22 01:48:58 2010 Tadayoshi Funaba <tadf@dotrb.org> * lib/date.rb: some improvements for performance. @@ -2043,6 +2043,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 863f047ad8..7713f07df2 100644 --- a/test/ruby/test_m17n.rb +++ b/test/ruby/test_m17n.rb @@ -1102,6 +1102,7 @@ class TestM17N < Test::Unit::TestCase end def test_str_concat + assert_equal(1, "".concat(0xA2)) assert_equal("A\x84\x31\xA4\x39".force_encoding("GB18030"), "A".force_encoding("GB18030") << 0x8431A439) end |