summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-06 15:39:00 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-06 15:39:00 +0000
commit2539f7c002cdcff341745effe114aaa5532d3f7a (patch)
tree1fdb105da4cba337d3aa41ba2452436506a4490b /test
parent3f4ef8222021363eac56f02f7ccd12fb8b551294 (diff)
downloadruby-2539f7c002cdcff341745effe114aaa5532d3f7a.tar.gz
ruby-2539f7c002cdcff341745effe114aaa5532d3f7a.tar.xz
ruby-2539f7c002cdcff341745effe114aaa5532d3f7a.zip
* 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
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_io_m17n.rb22
1 files changed, 22 insertions, 0 deletions
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("\"&#x4E02;\"".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("\"&#x4E02;\"".force_encoding("ascii-8bit"), content)
+ }
+ end
+
end