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 unpacking str 8 types even when {enable_str,true} is not set. #41

Closed
wants to merge 1 commit into from

Conversation

bb4242
Copy link

@bb4242 bb4242 commented Apr 24, 2015

Currently, msgpack fails to deserialize strings encoded as str 8 types unless {enable_str, true} is set, even though deserializing string types encoded as fixstr, str 16, and str 32 works without this option:

1> msgpack:unpack(<<2#10100001,1>>).
{ok,<<1>>}
2> msgpack:unpack(<<16#D9,1,1>>).                     
{error,incomplete}
3> msgpack:unpack(<<16#DA,0,1,1>>).
{ok,<<1>>}
4> msgpack:unpack(<<16#DB,0,0,0,1,1>>).
{ok,<<1>>}

5> msgpack:unpack(<<16#D9,1,1>>, [{enable_str,true}]).
{ok,[1]}

This pull request fixes case 2 so that it returns a binary string rather than failing, to be consistent with the behavior of cases 1, 3, and 4.

@kuenishi
Copy link
Member

I'll close this as I merged #58 but thank you for heads up.

@kuenishi kuenishi closed this Feb 16, 2016
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