diff options
author | Adam Chlipala <adamc@csail.mit.edu> | 2016-02-23 11:41:42 -0500 |
---|---|---|
committer | Adam Chlipala <adamc@csail.mit.edu> | 2016-02-23 11:41:42 -0500 |
commit | c4e27c0873014af57224bccee09286f1adbbfa05 (patch) | |
tree | 9af34db16f9c88b175127aec7f264511eee5016e /src | |
parent | d9957717c700eb0dfa6a2b2e0871e1a3712deafa (diff) |
Make JavaScript escaping handle ampersands properly
Diffstat (limited to 'src')
-rw-r--r-- | src/c/urweb.c | 12 |
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; |