You've already forked json-iterator
mirror of
https://github.com/json-iterator/go.git
synced 2025-06-18 22:57:33 +02:00
fix: invalid unicode while binary to string
This commit is contained in:
@ -22,11 +22,11 @@ func TestBinaryAsStringCodec(t *testing.T) {
|
||||
})
|
||||
t.Run("non safe set", func(t *testing.T) {
|
||||
should := require.New(t)
|
||||
output, err := jsoniter.Marshal([]byte{1, 2, 3, 15})
|
||||
output, err := jsoniter.Marshal([]byte{1, 2, 3, 23})
|
||||
should.NoError(err)
|
||||
should.Equal(`"\\x01\\x02\\x03\\x0f"`, string(output))
|
||||
should.Equal(`"\\x01\\x02\\x03\\x17"`, string(output))
|
||||
var val []byte
|
||||
should.NoError(jsoniter.Unmarshal(output, &val))
|
||||
should.Equal([]byte{1, 2, 3, 15}, val)
|
||||
should.Equal([]byte{1, 2, 3, 23}, val)
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user