mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-05-28 12:36:09 +00:00
check invalid unicode characters (0xd800 - 0xdfff, 0xfffe, 0xffff)
This commit is contained in:
@@ -1120,7 +1120,7 @@ public class Helper {
|
||||
public static boolean containsInvalidXMLCharacter(String text) {
|
||||
for (int i = 0; i < text.length(); i++) {
|
||||
char ch = text.charAt(i);
|
||||
if (!(ch > 31 || ch == 9 || ch == 10 || ch == 13)) {
|
||||
if (!isCharacterValidInXml(ch)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1132,7 +1132,7 @@ public class Helper {
|
||||
StringBuilder sb = new StringBuilder(text.length());
|
||||
for (int i = 0; i < text.length(); i++) {
|
||||
char ch = text.charAt(i);
|
||||
if (ch > 31 || ch == 9 || ch == 10 || ch == 13) {
|
||||
if (isCharacterValidInXml(ch)) {
|
||||
sb.append(ch);
|
||||
}
|
||||
}
|
||||
@@ -1140,6 +1140,12 @@ public class Helper {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static boolean isCharacterValidInXml(char ch) {
|
||||
return (ch > 31 && ch < 0xd800)
|
||||
|| ch == 9 || ch == 10 || ch == 13
|
||||
|| (ch >= 0xe000 && ch <= 0xfffd);
|
||||
}
|
||||
|
||||
public static Shape imageToShapeOld(BufferedImage image) {
|
||||
Area area = new Area();
|
||||
Rectangle rectangle = new Rectangle();
|
||||
|
||||
Reference in New Issue
Block a user