From 0bfa6b451ea7fc307904d0d27f853354a60bd4ba Mon Sep 17 00:00:00 2001 From: Henri Yandell Date: Sun, 19 Jul 2009 18:41:14 +0000 Subject: [PATCH] Adding unit test to show the problem reported in LANG-339 - namely that Chinese, Japanese etc characters are escaped. Furthermore the test notes that they are not subsequently unescaped; which means a lack of symmetry. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@795593 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/commons/lang/StringEscapeUtilsTest.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/test/org/apache/commons/lang/StringEscapeUtilsTest.java b/src/test/org/apache/commons/lang/StringEscapeUtilsTest.java index d3f8bd649..f8af28746 100644 --- a/src/test/org/apache/commons/lang/StringEscapeUtilsTest.java +++ b/src/test/org/apache/commons/lang/StringEscapeUtilsTest.java @@ -418,4 +418,16 @@ public class StringEscapeUtilsTest extends TestCase { assertEquals( "High unicode was not escaped correctly", "𝍢", escaped); } + + // https://issues.apache.org/jira/browse/LANG-339 + public void testEscapeHiragana() throws java.io.UnsupportedEncodingException { + // Some random Japanese unicode characters + String escaped = StringEscapeUtils.escapeHtml( "\u304B\u304C\u3068" ); + assertEquals( "Hiragana character unicode behaviour has changed from their being escaped", + "かがと", escaped); + + String unescaped = StringEscapeUtils.unescapeHtml( escaped ); + + assertEquals( "Hiragana character unicode behaviour has changed - expected no unescaping", escaped, escaped); + } }