Descriptionexp/template/html: make sure marshalled JSON can be parsed as JS.
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.
Patch Set 1 #Patch Set 2 : diff -r 9fd69d51a3bd https://go.googlecode.com/hg/ #Patch Set 3 : diff -r 9fd69d51a3bd https://go.googlecode.com/hg/ #
Total comments: 2
Patch Set 4 : diff -r 2c4ebd640b12 https://go.googlecode.com/hg/ #Patch Set 5 : diff -r 2c4ebd640b12 https://go.googlecode.com/hg/ #
MessagesTotal messages: 4
|