msgpack-javascript icon indicating copy to clipboard operation
msgpack-javascript copied to clipboard

Allow decoding raw strings

Open jasonpaulos opened this issue 2 years ago • 0 comments
trafficstars

This PR adds the ability to skip UTF-8 decoding of strings when you enable the rawStrings decoding option.

This is useful because I have encountered some encoded msgpack strings which do not contain valid UTF-8 data, and without a feature like this, it would be impossible to decode them properly.

According to the msgpack spec, this ability is encouraged:

  • String objects may contain invalid byte sequence and the behavior of a deserializer depends on the actual implementation when it received invalid byte sequence
    • Deserializers should provide functionality to get the original byte array so that applications can decide how to handle the object

jasonpaulos avatar Oct 30 '23 17:10 jasonpaulos