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

decode*With functions allow inclusion of invalid characters in the final result #20

Closed
jmillikin opened this issue Mar 23, 2012 · 1 comment

Comments

@jmillikin
Copy link
Contributor

The decoding functions like decodeUtf8With allow Text values to be constructed with invalid codepoints:

> decodeUtf8With (\_ -> fmap (\w -> chr (fromIntegral w + 0xDC00))) (Data.ByteString.Char8.pack "\227\129\130\187\227\129\130")
"\12354\56507\12354"

> Data.Text.pack "\12354\56507\12354"
"\12354\65533\12354"

Here, the codepoint U+DCBB is present in the decoded value even though it's reserved. If I try to run the same codepoints through pack, they are converted to the placeholder character.

@bos
Copy link
Contributor

bos commented Jan 15, 2013

Fixed by 1780bd7, thanks.

@bos bos closed this as completed Jan 15, 2013
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

2 participants