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:
parent
68f92eb395
commit
c11e09959c
1 changed files with 4 additions and 4 deletions
8
XML.java
8
XML.java
|
@ -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('"');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue