]> Cypherpunks repositories - gostls13.git/commitdiff
encoding/json: document angle bracket escaping.
authorDavid Symonds <dsymonds@golang.org>
Wed, 18 Jan 2012 01:56:24 +0000 (12:56 +1100)
committerDavid Symonds <dsymonds@golang.org>
Wed, 18 Jan 2012 01:56:24 +0000 (12:56 +1100)
Fixes #2643.

R=rsc, d_smithson
CC=golang-dev
https://golang.org/cl/5543068

src/pkg/encoding/json/encode.go

index 033da2d0ade140aff6389f0e886c99645f4cc203..727e8174bdb8dc5b1f92ea14217077ce10f8e014 100644 (file)
@@ -39,6 +39,8 @@ import (
 //
 // String values encode as JSON strings, with each invalid UTF-8 sequence
 // replaced by the encoding of the Unicode replacement character U+FFFD.
+// The angle brackets "<" and ">" are escaped to "\u003c" and "\u003e"
+// to keep some browsers from misinterpreting JSON output as HTML.
 //
 // Array and slice values encode as JSON arrays, except that
 // []byte encodes as a base64-encoded string.