diff --git a/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java b/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java index 02ae57350..1df178163 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java +++ b/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java @@ -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();