Update JavaScriptUtils

Add escaping for <, >, and PS/LS line terminators

Issue: SPR-9983
This commit is contained in:
Rossen Stoyanchev
2013-02-15 06:37:04 -05:00
parent 6e5cb7fbcd
commit f5c9fe69a4
2 changed files with 81 additions and 0 deletions

View File

@@ -80,6 +80,20 @@ public class JavaScriptUtils {
else if (c == '\013') {
filtered.append("\\v");
}
else if (c == '<') {
filtered.append("\\u003C");
}
else if (c == '>') {
filtered.append("\\u003E");
}
// Unicode for PS (line terminator in ECMA-262)
else if (c == '\u2028') {
filtered.append("\\u2028");
}
// Unicode for LS (line terminator in ECMA-262)
else if (c == '\u2029') {
filtered.append("\\u2029");
}
else {
filtered.append(c);
}