Skip to content

Commit 83047ca

Browse files
author
Sam Pullara
committed
add all characters 13 and under
1 parent 8f7f3a0 commit 83047ca

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

compiler/src/main/java/com/github/mustachejava/util/HtmlEscaper.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77

88
/**
99
* Escapes user data that you wish to include in HTML pages.
10-
*
11-
* Set
12-
* -Dmustache.escapeescaped if you want to reescape valid escaped HTML values
1310
*/
1411
public class HtmlEscaper {
1512
public static void escape(String value, Writer writer, boolean escapeEscaped) {
@@ -43,9 +40,13 @@ public static void escape(String value, Writer writer, boolean escapeEscaped) {
4340
case '\'':
4441
position = append(value, writer, position, i, "'");
4542
break;
46-
case '\n':
47-
position = append(value, writer, position, i, "
");
48-
break;
43+
}
44+
if (c <= 13) {
45+
writer.append(value, position, i);
46+
writer.append("&#");
47+
writer.append(String.valueOf((int)c));
48+
writer.append(";");
49+
position = i + 1;
4950
}
5051
}
5152
writer.append(value, position, length);

0 commit comments

Comments
 (0)