From 2539f7c002cdcff341745effe114aaa5532d3f7a Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 6 Sep 2008 15:39:00 +0000 Subject: * include/ruby/encoding.h (ECONV_ERROR_HANDLER_MASK): defined. (ECONV_DECODER_MASK): defined. (ECONV_ENCODER_MASK): defined. * io.c (make_writeconv): restrict ecflags for writeconv with ECONV_ERROR_HANDLER_MASK. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_io_m17n.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test') diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb index 0dd790f60..9d999be59 100644 --- a/test/ruby/test_io_m17n.rb +++ b/test/ruby/test_io_m17n.rb @@ -1459,5 +1459,27 @@ EOT } end + def test_w_xml_attr + with_tmpdir { + open("eucjp.txt", "w:euc-jp:utf-8", xml: :attr) {|f| + f.print "\u4E02" # U+4E02 is 0x3021 in JIS X 0212 + } + content = File.read("eucjp.txt", :mode=>"rb:ascii-8bit") + assert_equal("\"\x8F\xB0\xA1\"".force_encoding("ascii-8bit"), content) + + open("sjis.txt", "w:sjis:utf-8", xml: :attr) {|f| + f.print "\u4E02" # U+4E02 is 0x3021 in JIS X 0212 + } + content = File.read("sjis.txt", :mode=>"rb:ascii-8bit") + assert_equal("\"丂\"".force_encoding("ascii-8bit"), content) + + open("iso-2022-jp.txt", "w:iso-2022-jp:utf-8", xml: :attr) {|f| + f.print "\u4E02" # U+4E02 is 0x3021 in JIS X 0212 + } + content = File.read("iso-2022-jp.txt", :mode=>"rb:ascii-8bit") + assert_equal("\"丂\"".force_encoding("ascii-8bit"), content) + } + end + end -- cgit