Don't generate invalid JSON for unprintable chars #10

Closed
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+2 −2
Split
@@ -445,9 +445,9 @@ private void writeEscapedString(String string, StringBuilder builder) {
if((ch>='\u0000' && ch<='\u001F') || (ch>='\u007F' && ch<='\u009F') || (ch>='\u2000' && ch<='\u20FF')){
String hex = Integer.toHexString(ch);
builder.append("\\u");
- for(int j = 0; j < 4-builder.length(); j++)
+ for(int j = 0; j < 4-hex.length(); j++)
builder.append('0');
- builder.append(string.toUpperCase());
+ builder.append(hex.toUpperCase());
} else {
builder.append(ch);
}