diff options
-rw-r--r-- | test/ruby/test_io_m17n.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb index b8b532e94c..67f48527b5 100644 --- a/test/ruby/test_io_m17n.rb +++ b/test/ruby/test_io_m17n.rb @@ -791,6 +791,21 @@ EOT } end + def test_set_encoding_undef_replace + with_pipe {|r, w| + w << "\ufffd" + w.close + r.set_encoding("utf-8", "euc-jp", :undef=>:replace, :replace=>"ZZZ") + assert_equal("ZZZ", r.read) + } + with_pipe {|r, w| + w << "\ufffd" + w.close + r.set_encoding("utf-8:euc-jp", :undef=>:replace, :replace=>"ZZZ") + assert_equal("ZZZ", r.read) + } + end + def test_write_conversion_fixenc with_pipe {|r, w| w.set_encoding("iso-2022-jp:utf-8") |