-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
codec: generalize DecodeOptions:RawToString flag (for all encodings)
When decoding into a nil interface{} (naked decoding), we peek at the stream and decode into a type that matches the stream. Previously, we treated string type as UTF-8. However, a go string is just a sequence of bytes (an immutable view of []byte), that makes no determination of the encoding. To that effect, some users want to decode an un-encoded sequence of bytes in the stream as an immutable view (a string). We now enable this via the flag:RawToString. Now, if we peek at the stream and it is a sequence of bytes, we will decode it into a string if RawToString=true. By default, it continues to be decoded into a []byte. Updates #286
- Loading branch information
Showing
6 changed files
with
30 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters