1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

- add regression tests for U+6E7F (湿) in ISO-2022-JP

In ISO-2022-JP, the bytes use to code are the same as those for "<>".
  This adds regression tests to make sure that these bytes, when representing
  湿, are NOT escaped with encode("ISO-2022-JP, xml: :text) or similar.
  These are additional regression tests for #12052.
This commit is contained in:
Martin Dürst 2021-07-01 17:33:43 +09:00
parent 9ca3051660
commit f6539202c5

View file

@ -143,6 +143,9 @@ class TestTranscode < Test::Unit::TestCase
assert_equal('"&lt;&quot;&gt;"', escaped.encode('UTF-8'), "failed encoding #{src_enc} to #{dst_enc} with xml: :attr")
end
end
# regression test; U+6E7F (湿) uses the same bytes in ISO-2022-JP as "<>"
assert_equal( "&lt;&gt;\u6E7F", "<>\u6E7F".encode("ISO-2022-JP").encode("ISO-2022-JP", :xml=>:text).encode("UTF-8"))
assert_equal("\"&lt;&gt;\u6E7F\"", "<>\u6E7F".encode("ISO-2022-JP").encode("ISO-2022-JP", :xml=>:attr).encode("UTF-8"))
end
def test_ascii_range