aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/encoding
diff options
context:
space:
mode:
authorAndrew Gerrand <adg@golang.org>2014-08-08 08:57:41 +1000
committerAndrew Gerrand <adg@golang.org>2014-08-08 08:57:41 +1000
commit77a8dcab03c1bf8efa5cafaa2d9dc0a9f7a3dcf6 (patch)
tree1c2da08156df7471da1f188b67084fc2ba9105f0 /src/pkg/encoding
parentf3fa0bbd1f011c7436f21a18ee08f719a15b02b8 (diff)
downloadgo-77a8dcab03c1bf8efa5cafaa2d9dc0a9f7a3dcf6.tar.xz
encoding/json: document coercion of invalid UTF-8 characters
Fixes #8342. LGTM=iant R=golang-codereviews, iant CC=golang-codereviews https://golang.org/cl/122180043
Diffstat (limited to 'src/pkg/encoding')
-rw-r--r--src/pkg/encoding/json/encode.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pkg/encoding/json/encode.go b/src/pkg/encoding/json/encode.go
index 741ddd89cb..5341a3a01b 100644
--- a/src/pkg/encoding/json/encode.go
+++ b/src/pkg/encoding/json/encode.go
@@ -40,8 +40,8 @@ import (
//
// Floating point, integer, and Number values encode as JSON numbers.
//
-// String values encode as JSON strings. InvalidUTF8Error will be returned
-// if an invalid UTF-8 sequence is encountered.
+// String values encode as JSON strings coerced to valid UTF-8,
+// replacing invalid bytes with the Unicode replacement rune.
// The angle brackets "<" and ">" are escaped to "\u003c" and "\u003e"
// to keep some browsers from misinterpreting JSON output as HTML.
// Ampersand "&" is also escaped to "\u0026" for the same reason.