]> Cypherpunks repositories - gostls13.git/commit
encoding/json: escape & always
authorRuss Cox <rsc@golang.org>
Fri, 9 Aug 2013 22:33:57 +0000 (18:33 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 9 Aug 2013 22:33:57 +0000 (18:33 -0400)
commit080e00d55d37be67be30e2723233594e64097edf
tree5352fd9e86da09b41220317b99f1ee0f0f142de2
parent36f223dace5dcdb7afc381c51e0484ff473e2e88
encoding/json: escape & always

There are a few different places in the code that escape
possibly-problematic characters like < > and &.
This one was the only one missing &, so add it.

This means that if you Marshal a string, you get the
same answer you do if you Marshal a string and
pass it through the compactor. (Ironically, the
compaction makes the string longer.)

Because html/template invokes json.Marshal to
prepare escaped strings for JavaScript, this changes
the form of some of the escaped strings, but not
their meaning.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12708044
src/pkg/encoding/json/encode.go
src/pkg/html/template/content_test.go
src/pkg/html/template/escape_test.go