1
0
Fork 0
mirror of https://github.com/ethauvin/JSON-java.git synced 2025-06-17 07:50:52 -07:00

Fixes code point output when unescaping code points. XML escapes are an entire code point, not surrogate pairs like in JSON.

This commit is contained in:
John J. Aylward 2016-09-22 15:40:26 -04:00
parent 68f92eb395
commit c11e09959c

View file

@ -165,15 +165,15 @@ public class XML {
if (semic > i) {
final String entity = string.substring(i + 1, semic);
if (entity.charAt(0) == '#') {
char cc;
int cp;
if (entity.charAt(1) == 'x') {
// hex encoded unicode
cc = (char) Integer.parseInt(entity.substring(2), 16);
cp = Integer.parseInt(entity.substring(2), 16);
} else {
// decimal encoded unicode
cc = (char) Integer.parseInt(entity.substring(1));
cp = Integer.parseInt(entity.substring(1));
}
sb.append(cc);
sb.append(new String(Character.toChars(cp)));
} else {
if ("quot".equalsIgnoreCase(entity)) {
sb.append('"');