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 class NumericEntityEscaper extends CodePointTranslator {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: if (codepoint > 0xffff) ?
|
||||
out.write("&#");
|
||||
out.write(Integer.toString(codepoint, 10));
|
||||
out.write(';');
|
||||
|
|
|
@ -47,4 +47,16 @@ public class NumericEntityEscaperTest extends TestCase {
|
|||
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…
Reference in New Issue