Skip to content

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

Open
@ali-abrar

Description

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.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions