Closed adolenc closed 9 years ago
Hi Andrej,
looks good to me.
Regarding bin as strings I'd like to tell you about https://github.com/phmarek/neovim/commit/5a91c7ef56eac0d7fc08446af25206beb4644ad3 and the discussion at https://github.com/neovim/neovim/pull/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!
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?
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.
Fair enough :+1: .
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.