-
Notifications
You must be signed in to change notification settings - Fork 345
JSON.dump("\x82\xAC\xEF".b) no error with the C extension #634
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
Comments
It is known, and I don't plan to change it until 3.0. Ref: #609 |
I think it's due to using |
I added the behavior back on purpose because I realized a bunch of apps relied on it. It's easy to remove, I just want to emit deprecations first to help people fix their code. |
Hum, wait. I think I'm misreading your report. |
yeah, this is a regression from 2.7.2, good catch I'll fix it. |
I think it's related but not the same, #609 is about bytes valid in UTF-8 and this is about bytes invalid in UTF-8. I'm not sure about the semantics of |
I think the function to use is |
I guess in the C ext to preserve #609 we'll need something equivalent to: if str.encoding == BINARY
str = str.dup.force_encoding(UTF_8)
else
str = str.encode(UTF_8)
end And then the |
Yup. I got a quick patch in that effect that passes the tests: byroot@170ec37 I'll clean it up tomorrow and merge this PR with it. |
Uh oh!
There was an error while loading. Please reload this page.
On json 2.7.2:
On json master:
The text was updated successfully, but these errors were encountered: