Escaping supplementary chars seems good for NumericEntityEscaper. LANG-617

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@956782 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Henri Yandell 2010-06-22 06:19:29 +00:00
parent 590867417d
commit c0041cafc2
2 changed files with 12 additions and 1 deletions

View File

@ -72,7 +72,6 @@ public boolean translate(int codepoint, Writer out) throws IOException {
}
}
// TODO: if (codepoint > 0xffff) ?
out.write("&#");
out.write(Integer.toString(codepoint, 10));
out.write(';');

View File

@ -47,4 +47,16 @@ public void testAbove() {
String result = nee.translate(input);
assertEquals("Failed to escape numeric entities via the above method", "ADFGZ", result);
}
// See LANG-617
public void testSupplementary() {
NumericEntityEscaper nee = new NumericEntityEscaper();
String input = "\uD803\uDC22";
String expected = "𐰢";
String result = nee.translate(input);
assertEquals("Failed to escape numeric entities supplementary characters", expected, result);
}
}