Skip to content

Commit

Permalink
encoding/json: document coercion of invalid UTF-8 characters
Browse files Browse the repository at this point in the history
Fixes #8342.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/122180043
  • Loading branch information
adg committed Aug 7, 2014
1 parent f3fa0bb commit 77a8dca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pkg/encoding/json/encode.go
Expand Up @@ -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.
Expand Down

0 comments on commit 77a8dca

Please sign in to comment.