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

Data.JSString incompatible with Data.Text for certain code points #126

Open
ali-abrar opened this issue Aug 21, 2019 · 2 comments
Open

Data.JSString incompatible with Data.Text for certain code points #126

ali-abrar opened this issue Aug 21, 2019 · 2 comments

Comments

@ali-abrar
Copy link

Data.Text performs a replacement on code points ["\55296" .. "\57343"] during certain operations (see this issue). Data.JSString, which uses JavaScript's builtin fromCodePoint (available as of ECMAScript 6) does not do this replacement.

Here's the behavior of Data.Text:

Prelude T> T.pack ['\xD800']
"\65533"
Prelude T> print '\xD800'
'\55296'
Prelude T> T.unpack (T.pack ['\xD800'])
"\65533"

As you can see, it doesn't roundtrip. By comparison, fromCodePoint and codePointAt in JavaScript do roundtrip on this value.

ali-abrar added a commit to reflex-frp/reflex-platform that referenced this issue Sep 5, 2019
@ali-abrar
Copy link
Author

This is the replacement Data.Text does: https://hackage.haskell.org/package/text-1.2.4.0/docs/Data-Text-Internal.html#v:safe

@mightybyte
Copy link

Can confirm that this is an issue that is impacting a production codebase. Would be great if we could get a fix.

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