encoding/json: document and test use of unicode.ReplacementChar

Fixes #4783.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7314099
This commit is contained in:
Russ Cox 2013-02-14 14:56:01 -05:00
parent 31072e41f4
commit 30359a55c2
2 changed files with 42 additions and 0 deletions

View file

@ -55,6 +55,11 @@ import (
// If no more serious errors are encountered, Unmarshal returns
// an UnmarshalTypeError describing the earliest such error.
//
// When unmarshaling quoted strings, invalid UTF-8 or
// invalid UTF-16 surrogate pairs are not treated as an error.
// Instead, they are replaced by the Unicode replacement
// character U+FFFD.
//
func Unmarshal(data []byte, v interface{}) error {
// Check for well-formedness.
// Avoids filling out half a data structure