encoding/json: document Valid allows invalid utf8 #58517
Labels
Documentation
Issues describing a change to documentation.
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I passed a binary garbage wrapped in
"
quotes tojson.Valid
.https://go.dev/play/p/rrtmrEL3Ipd
What did you expect to see?
As JSON is specified to be "a sequence of Unicode code points" (ECMA-404) or "encoded in UTF-8, UTF-16, or UTF-32" (RFC 7159) I would expect that a JSON document containing bytes that cannot be interpreted as Unicode codepoints to not be considered valid.
What did you see instead?
It considered the document to be valid, even though it contains bytes that cannot be interpreted as Unicode codepoints.
The text was updated successfully, but these errors were encountered: