From 6e285ebade0aa819186cb6b6657b9de5169749ff Mon Sep 17 00:00:00 2001 From: David Symonds Date: Wed, 18 Jan 2012 12:56:24 +1100 Subject: [PATCH] encoding/json: document angle bracket escaping. Fixes #2643. R=rsc, d_smithson CC=golang-dev https://golang.org/cl/5543068 --- src/pkg/encoding/json/encode.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pkg/encoding/json/encode.go b/src/pkg/encoding/json/encode.go index 033da2d0ad..727e8174bd 100644 --- a/src/pkg/encoding/json/encode.go +++ b/src/pkg/encoding/json/encode.go @@ -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. -- 2.48.1