-
Notifications
You must be signed in to change notification settings - Fork 117
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
Unpack strings to ASCII-8Bit, not UTF-8 #40
Comments
But they can do |
Yes they can, of course, after getting an |
#44 presents another solution, and the one I chose for the JRuby implementation. The solution proposed here would have been the right one with the first version of the MessagePack spec, but since the updated version and the addition of the UTF-8 type there's actually a way to tell the difference. @paddor would you agree that #44 solves your problem? Can we close this issue in favour of it? |
I guess you meant #45? Yeah, that would definitely be very nice solution to my problem. |
Yes #45, sorry. That’s good. Now, if I only can get you to switch to JRuby, your problem will be solved…
|
Why switch to JRuby? Does that pull request only work for JRuby or what? And don't worry, my problem is solved/worked-around already. Just an inconvenience I noticed and thought could be improved. Pretty sure the 'bin' type in MsgPack didn't exist back then yet. |
I just meant that the semantics proposed in #44/#45 are already implemented in msgpack-0.5.10-java, but not in the MRI release of the same version. |
Oh okay. No need to rush with that. |
|
MessagePack doesn't know the encoding of any String in a message serialized with MessagePack. Some of the Strings might be byte arrays (since there's no real distinction between Strings and byte arrays in MessagePack), and those will cause problems later when the wrongly-encoded Strings are used where a correct encoding is expected.
I suggest you set the encoding of unpacked Strings to ASCII-8Bit (
Encoding::ASCII_8BIT
). Users of this library who expect a String (not a byte array) will have to useString#force_encoding
because only they know what unpacked Strings have which encoding.The text was updated successfully, but these errors were encountered: