Filter out invalid XML characters below 0x20 in encodeXml().
This commit is contained in:
parent
3d6da645c5
commit
abd0b867b3
1 changed files with 8 additions and 1 deletions
|
@ -526,7 +526,14 @@ public final class HtmlEncoder {
|
|||
ret.append ("&");
|
||||
break;
|
||||
default:
|
||||
if (c < 0x20) {
|
||||
// sort out invalid XML characters below 0x20 - all but 0x9, 0xA and 0xD.
|
||||
// The trick is an adaption of java.lang.Character.isSpace().
|
||||
if (((((1L << 0x9) | (1L << 0xA) | (1L << 0xD)) >> ch) & 1L) != 0)
|
||||
ret.append (c);
|
||||
} else {
|
||||
ret.append (c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue