Added JS escaping for newline, linefeed, return, tab and backspace. Closes #1

This commit is contained in:
Erik C. Thauvin 2024-02-28 03:29:29 -08:00
parent a0ebfe2566
commit 0d14c27032
2 changed files with 10 additions and 0 deletions

View file

@ -195,6 +195,11 @@ public final class RenderUtils {
case '"' -> sb.append("\\\"");
case '\\' -> sb.append("\\\\");
case '/' -> sb.append("\\/");
case '\b' -> sb.append("\\b");
case '\n' -> sb.append(("\\n"));
case '\t' -> sb.append("\\t");
case '\f' -> sb.append("\\f");
case '\r' -> sb.append("\\r");
default -> sb.append(c);
}
}
@ -597,4 +602,5 @@ public final class RenderUtils {
}
return false;
}
}