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

UTF-16 surrogate pairs decoding #3

Open
vshabanov opened this issue Apr 6, 2021 · 4 comments
Open

UTF-16 surrogate pairs decoding #3

vshabanov opened this issue Apr 6, 2021 · 4 comments

Comments

@vshabanov
Copy link

vshabanov commented Apr 6, 2021

Hi, UTF-16 surrogate pairs are incorrectly decoded:

λ> Json.decode $ Bytes.fromByteString "\"\\ud800\\udc00\""
Right (String "\65533\65533")
-- should be
λ> Aeson.decode "\"\\ud800\\udc00\"" :: Maybe Aeson.Value
Just (String "\65536")

And invalid sequences are emitted in some cases:

λ> J.decode $ Bytes.fromByteString "\"\\ud800\\udfff\""
Right (String "*** Exception: recoverDecode: invalid argument (invalid byte sequence)
-- should be
λ> Aeson.decode "\"\\ud800\\udfff\"" :: Maybe Aeson.Value
Just (String "\66559")
@andrewthad
Copy link
Member

Thanks for the report with good examples. I'll figure out how to address this soon.

@mwotton
Copy link

mwotton commented Mar 2, 2023

any luck with this? this is a blocking bug for me now so I'm happy to put some time in, but I'm by no means a unicode expert.

@andrewthad
Copy link
Member

I have not made any attempts to fix this. If you are able to fix it, though, I would welcome a PR.

@mwotton
Copy link

mwotton commented Mar 9, 2023

alright, i'll give it a go.

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

No branches or pull requests

3 participants