Skip to content

Commit 2713f2e

Browse files
committed
Adds testing for unicode entities
1 parent cb61bbf commit 2713f2e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/test/java/org/json/junit/XMLTest.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,11 +782,20 @@ public void testUnescape() {
782782
XML.toJSONObject("<xml>Can cope &amp;; </xml>").toString());
783783
assertEquals("Can cope &; ", XML.unescape("Can cope &amp;; "));
784784

785+
// unicode entity
786+
assertEquals("{\"xml\":\"Can cope 4;\"}",
787+
XML.toJSONObject("<xml>Can cope &#x34;; </xml>").toString());
788+
assertEquals("Can cope 4; ", XML.unescape("Can cope &#x34;; "));
789+
785790
// double escaped
786791
assertEquals("{\"xml\":\"Can cope &lt;\"}",
787792
XML.toJSONObject("<xml>Can cope &amp;lt; </xml>").toString());
788793
assertEquals("Can cope &lt; ", XML.unescape("Can cope &amp;lt; "));
789794

790-
}
795+
assertEquals("{\"xml\":\"Can cope &#x34;\"}",
796+
XML.toJSONObject("<xml>Can cope &amp;#x34; </xml>").toString());
797+
assertEquals("Can cope &#x34; ", XML.unescape("Can cope &amp;#x34; "));
798+
799+
}
791800

792801
}

0 commit comments

Comments
 (0)