summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-22 03:01:45 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-22 03:01:45 +0000
commit3002e5e1f9767e914ccd3e1fcfd96b38b1fd438f (patch)
tree6fb0d5343a6659dd0c0fe75b4f4837b0bc926e28
parentd9615bf9c54414906ea9bac51f2a6e7ffd10c5cf (diff)
* 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--ChangeLog5
-rw-r--r--string.c2
-rw-r--r--test/ruby/test_m17n.rb1
3 files changed, 8 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index aa809e4074..8a74d01e01 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/string.c b/string.c
index f77032f635..20466e16f2 100644
--- a/string.c
+++ b/string.c
@@ -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