diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-13 01:26:46 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-13 01:26:46 +0000 |
commit | c871aee96b0d5112ecc040cd56e84a2d7fe2e3c5 (patch) | |
tree | 79cc8b670a36a3e92fef2270dac492753f0065a3 /test | |
parent | 9afaef347c84e8e90312d3335c887d2c65acc86b (diff) | |
download | ruby-c871aee96b0d5112ecc040cd56e84a2d7fe2e3c5.tar.gz |
* transcode.c (transcode_loop): insert output the value when
fallback hash has a related key. [ruby-dev:40540]
[ruby-dev:40829] #3036
* transcode.c (rb_econv_prepare_opts): pass to newhash
a value with the key :fallback.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_transcode.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/test/ruby/test_transcode.rb b/test/ruby/test_transcode.rb index 7f73d31797..d16a4d534b 100644 --- a/test/ruby/test_transcode.rb +++ b/test/ruby/test_transcode.rb @@ -1892,8 +1892,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u795E\u6797\u7FA9\u535A", "\xAF\xAB\xAA\x4C\xB8\x71\xB3\xD5", 'Big5-HKSCS') # 神林義博 end - def - test_Big5_UAO + def test_Big5_UAO check_both_ways("\u4e17", "\x81\x40", 'Big5-UAO') # 丗 end @@ -1903,4 +1902,13 @@ class TestTranscode < Test::Unit::TestCase assert_equal(Encoding::US_ASCII, a.encoding) assert_equal(Encoding::Shift_JIS, b.encoding) end + + def test_fallback + assert_equal("\u3042".encode("EUC-JP"), "\u{20000}".encode("EUC-JP", + fallback: {"\u{20000}" => "\u3042".encode("EUC-JP")})) + assert_equal("\u3042".encode("EUC-JP"), "\u{20000}".encode("EUC-JP", + fallback: {"\u{20000}" => "\u3042"})) + assert_equal("[ISU]", "\u{1F4BA}".encode("SJIS-KDDI", + fallback: {"\u{1F4BA}" => "[ISU]"})) + end end |