summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-15 19:02:10 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-15 19:02:10 +0000
commit9b71251e1e8f86972df2c0eda7c4209c5da7488a (patch)
treeb6c48f35a415eccd80f4dfb59b0572caf7d617aa /test
parent243d224f285c8a4a5e4db344e2f4d4023cf8d2e9 (diff)
merge revision(s) 55181: [Backport #12431]
* transcode.c (str_transcode0): scrub in the given encoding when the source encoding is given, not in the encoding of the receiver. [ruby-core:75732] [Bug #12431] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@55905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_transcode.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/ruby/test_transcode.rb b/test/ruby/test_transcode.rb
index 33e7467102..2f97d098fd 100644
--- a/test/ruby/test_transcode.rb
+++ b/test/ruby/test_transcode.rb
@@ -1213,6 +1213,9 @@ class TestTranscode < Test::Unit::TestCase
def test_invalid_replace_string
assert_equal("a<x>A", "a\x80A".encode("us-ascii", "euc-jp", :invalid=>:replace, :replace=>"<x>"))
assert_equal("a<x>A", "a\x80A".encode("us-ascii", "euc-jis-2004", :invalid=>:replace, :replace=>"<x>"))
+ s = "abcd\u{c1}"
+ r = s.b.encode("UTF-8", "UTF-8", invalid: :replace, replace: "\u{fffd}")
+ assert_equal(s, r)
end
def test_undef_replace