summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@csail.mit.edu>2016-02-23 11:41:42 -0500
committerGravatar Adam Chlipala <adamc@csail.mit.edu>2016-02-23 11:41:42 -0500
commitc4e27c0873014af57224bccee09286f1adbbfa05 (patch)
tree9af34db16f9c88b175127aec7f264511eee5016e
parentd9957717c700eb0dfa6a2b2e0871e1a3712deafa (diff)
Make JavaScript escaping handle ampersands properly
-rw-r--r--src/c/urweb.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/c/urweb.c b/src/c/urweb.c
index a9a169b8..620893c0 100644
--- a/src/c/urweb.c
+++ b/src/c/urweb.c
@@ -1568,6 +1568,10 @@ uw_Basis_string uw_Basis_jsifyString(uw_context ctx, uw_Basis_string s) {
strcpy(s2, "\\074");
s2 += 4;
break;
+ case '&':
+ strcpy(s2, "\\046");
+ s2 += 4;
+ break;
default:
if (isprint((int)c) || c >= 128)
*s2++ = c;
@@ -1609,6 +1613,10 @@ uw_Basis_string uw_Basis_jsifyChar(uw_context ctx, uw_Basis_char c1) {
strcpy(s2, "\\074");
s2 += 4;
break;
+ case '&':
+ strcpy(s2, "\\046");
+ s2 += 4;
+ break;
default:
if (isprint((int)c) || c >= 128)
*s2++ = c;
@@ -1647,6 +1655,10 @@ uw_Basis_string uw_Basis_jsifyString_ws(uw_context ctx, uw_Basis_string s) {
strcpy(s2, "\\074");
s2 += 4;
break;
+ case '&':
+ strcpy(s2, "\\046");
+ s2 += 4;
+ break;
default:
if (isprint((int)c) || c >= 128)
*s2++ = c;