This commit is contained in:
Looly
2021-06-07 01:59:07 +08:00
parent 028c3ed60d
commit 70eb424cd5
11 changed files with 23 additions and 40 deletions

View File

@@ -675,14 +675,12 @@ public class JSONUtil {
return writer;
}
char b; // 前一个字符
char c; // 当前字符
int len = str.length();
if (isWrap) {
writer.write('"');
}
for (int i = 0; i < len; i++) {
// b = c;
c = str.charAt(i);
switch (c) {
case '\\':
@@ -690,13 +688,6 @@ public class JSONUtil {
writer.write("\\");
writer.write(c);
break;
//此处转义导致输出不和预期一致
// case '/':
// if (b == '<') {
// writer.write('\\');
// }
// writer.write(c);
// break;
default:
writer.write(escape(c));
}