mirror of
https://github.com/apache/commons-lang.git
synced 2025-02-11 20:45:05 +00:00
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:
parent
590867417d
commit
c0041cafc2
@ -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(';');
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user