Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow decoding raw strings #235

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jasonpaulos
Copy link

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

README.md Outdated Show resolved Hide resolved
Comment on lines +29 to +31
* Note that this option only applies to string values, not map keys. Additionally, when
* enabled, raw string length is limited by the maxBinLength option.
*/
Copy link

@jannotti jannotti Oct 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not do this for map keys as well?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This library doesn't support binary keys, so I decided to skip that case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants