• Mike Samuel's avatar
    exp/template/html: make sure marshalled JSON can be parsed as JS. · 10bf7447
    Mike Samuel authored
    This makes sure that all JS newlines are encoded in JSON.
    
    It also moots a TODO about possibly escaping supplemental codepoints.
    I served:
    
    Content-Type: text/javascript;charset=UTF-8
    
    var s = "%s";
    document.write("<p>", s, "</p><ol>");
    for (var i = 0; i < s.length; i++) {
      document.write("<li>", s.charCodeAt(i).toString(16), "</li>");
    }
    document.write("</l>");
    
    where %s was replaced with bytes "\xf0\x9d\x84\x9e" to test
    straight UTF-8 instead of encoding surrogates separately.
    
    Recent Firefox, Chrome, and Safari all decoded it properly.
    I have yet to try it on IE or older versions.
    
    R=nigeltao
    CC=golang-dev
    https://golang.org/cl/5129042
    10bf7447
Name
Last commit
Last update
..
cmd Loading commit data...
lib9 Loading commit data...
libbio Loading commit data...
libmach Loading commit data...
pkg Loading commit data...
Make.ccmd Loading commit data...
Make.clib Loading commit data...
Make.cmd Loading commit data...
Make.common Loading commit data...
Make.inc Loading commit data...
Make.pkg Loading commit data...
all-qemu.bash Loading commit data...
all.bash Loading commit data...
clean.bash Loading commit data...
env.bash Loading commit data...
make.bash Loading commit data...
quietgcc.bash Loading commit data...
run.bash Loading commit data...
sudo.bash Loading commit data...
version.bash Loading commit data...