From c871aee96b0d5112ecc040cd56e84a2d7fe2e3c5 Mon Sep 17 00:00:00 2001 From: naruse Date: Tue, 13 Apr 2010 01:26:46 +0000 Subject: * 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 --- test/ruby/test_transcode.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'test/ruby') 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 -- cgit v1.2.3