From a10a5ddaacb05368cee3beec82af47043aec6667 Mon Sep 17 00:00:00 2001 From: akr Date: Fri, 5 Sep 2008 21:29:12 +0000 Subject: * enc/trans/escape.trans: new file. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_econv.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test') diff --git a/test/ruby/test_econv.rb b/test/ruby/test_econv.rb index 0a774c4a7a..be4917ddf7 100644 --- a/test/ruby/test_econv.rb +++ b/test/ruby/test_econv.rb @@ -692,5 +692,19 @@ class TestEncodingConverter < Test::Unit::TestCase ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1", Encoding::Converter::UNDEF_HEX_CHARREF) assert_equal("交換法則: n\xD7m=m\xD7n".force_encoding("ISO-8859-1"), ec.convert("\xB8\xF2\xB4\xB9\xCB\xA1\xC2\xA7: n\xA1\xDFm=m\xA1\xDFn")) + + ec = Encoding::Converter.new("UTF-8", "US-ASCII", Encoding::Converter::UNDEF_HEX_CHARREF) + assert_equal("&", ec.convert("&")) + end + + def test_html_escape + ec = Encoding::Converter.new("", "amp-escaped") + assert_equal('&<>"', ec.convert("&<>\"")) + + ec = Encoding::Converter.new("", "html-text-escaped") + assert_equal('&<>"', ec.convert("&<>\"")) + + ec = Encoding::Converter.new("", "html-attr-escaped") + assert_equal('&<>"', ec.convert("&<>\"")) end end -- cgit v1.2.3