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

Support bin 16 and bin 32 types and decode bin as str #7

Merged
merged 3 commits into from Aug 13, 2015

Conversation

adolenc
Copy link
Collaborator

@adolenc adolenc commented Aug 10, 2015

I would submit this as 2 separate pull requests, but I cannot figure out how to do that at all. In any case, first commit adds support for decoding 0xc5 (bin 16) and 0xc6 (bin 32) as per msgpack spec.

Second commit is IMHO a bit controversial. It adds decode-bin-as-string which, when set to T, tells the decoder to read binary arrays as strings. This is useful because some programs (namely neovim), due to supporting various encodings on their side of things, send strings using this type.

On one hand by default this commit doesn't really affect users that don't want/expect this behavior, but on the other hand it can easily be argued that interpreting bin as str is not really the work of cl-messagepack. I'll leave the decision up to you.

By setting *decode-bin-as-string* to T bin 8, bin 16 and bin 32 types
will be decoded as strings.
@phmarek
Copy link
Collaborator

phmarek commented Aug 11, 2015

Hi Andrej,

looks good to me.

Regarding bin as strings I'd like to tell you about phmarek/neovim@5a91c7e and the discussion at neovim/neovim#1758 (if you're interested) - so I'll accept that as well ;)

Would you please prepare one more patch with a few lines of tests?

Thanks a lot!

@adolenc
Copy link
Collaborator Author

adolenc commented Aug 12, 2015

Ah, very nice to know you were involved, makes this a lot easier :) .

In any case, I added some basic tests, hope they are OK. To be completely honest though, it bothers me a bit that while the package with this patch now supports decoding of bin format, it doesn't support encoding it as far as I can tell?

phmarek added a commit that referenced this pull request Aug 13, 2015
Support bin 16 and bin 32 types and decode bin as str
@phmarek phmarek merged commit e0c9d1b into mbrezu:master Aug 13, 2015
@phmarek
Copy link
Collaborator

phmarek commented Aug 13, 2015

Thanks a lot!

Well, it doesn't bother me. If we ever find out that we need the same feature for encoding, we can still add it.

@adolenc
Copy link
Collaborator Author

adolenc commented Aug 13, 2015

Fair enough 👍 .

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.

None yet

2 participants