From 0cda4bb3bf099874662a10d1e66522369812716e Mon Sep 17 00:00:00 2001 From: akr Date: Thu, 16 Oct 2008 15:25:25 +0000 Subject: * io.c (rb_io_binmode): reset encoding conversion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_io_m17n.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb index bff2846608..eeec26d61e 100644 --- a/test/ruby/test_io_m17n.rb +++ b/test/ruby/test_io_m17n.rb @@ -678,7 +678,6 @@ EOT def test_getc_invalid3 with_pipe("utf-16le:euc-jp") {|r, w| - w.binmode before1 = "\x42\x30".force_encoding("utf-16le") before2 = "\x44\x30".force_encoding("utf-16le") invalid = "\x00\xd8".force_encoding("utf-16le") @@ -1539,6 +1538,18 @@ EOT } end + def test_binmode3 + with_tmpdir { + src = "\u3042\r\n" + generate_file("t.txt", src) + srcbin = src.dup.force_encoding("ascii-8bit") + open("t.txt", "rt:utf-8:euc-jp") {|f| + f.binmode + assert_str_equal(srcbin, f.read) + } + } + end + def test_invalid_r with_tmpdir { generate_file("t.txt", "a\x80b") -- cgit v1.2.3