Unverified Commit 3b2d595a authored by skylot's avatar skylot Committed by GitHub

Merge pull request #255 from skylot/xml_unreadable_chars_escapes

Adds more escape for unreadable characters so parser won't throw exceptions during parse
parents b29223c5 d805ec15
...@@ -149,6 +149,9 @@ public class StringUtils { ...@@ -149,6 +149,9 @@ public class StringUtils {
} }
private static String escapeXmlChar(char c) { private static String escapeXmlChar(char c) {
if(c >= 0 && c <= 0x1F) {
return "\\" + (int) c;
}
switch (c) { switch (c) {
case '&': case '&':
return "&amp;"; return "&amp;";
...@@ -160,6 +163,8 @@ public class StringUtils { ...@@ -160,6 +163,8 @@ public class StringUtils {
return "&quot;"; return "&quot;";
case '\'': case '\'':
return "&apos;"; return "&apos;";
case '\\':
return "\\\\";
default: default:
return null; return null;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment