You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is the expected output?
json.Unmarshal should return json.InvalidUTF8Error for input streams containing
non-Unicode runes
What do you see instead?
Non-Unicode runes replaced by surrogates
Which version are you using? (run 'go version')
go version devel +439cb8bad388 Wed Feb 06 17:18:53 2013 -0800 linux/amd64
Please provide any additional information below.
This program ought to return an error, though it replaces the input stream with Unicode
surrogates. Maybe Unmarshal deserves a parameter or an UnmarshalWithError - method?
http://play.golang.org/p/r2AWWqdSNY
The text was updated successfully, but these errors were encountered:
\ufffd is not a surrogate, it is a unicode replacement character.
we can't change the behavior of unmarshal now, but we should at least document that
InvalidUTF8Error only applies to encoding,
and make it clear that Unmarshal will use \ufffd to replace any incorrect utf-8 bytes.
Actually, the source code is working quite hard to substitute the replacement characters
where appropriate, so I will defer to the intent of the original author (me a few years
ago) and leave it as is. But I will add docs and tests.
The text was updated successfully, but these errors were encountered: