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

Fix encoding error in toResponse #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

niteria
Copy link

@niteria niteria commented Jun 15, 2020

The old code uses Data.ByteString.Char8.pack which destroys unicode.
Example:

ghci> Data.ByteString.Char8.pack "\9679"
"\207"

The return value of JS.getResponseText is overloaded to return something
of type FromJSString result => Maybe result.

There's no instance FromJSString ByteString in scope so the next best thing
is the Text instance.

This actually came up in my project and this patch fixed it.

The old code uses `Data.ByteString.Char8.pack` which destroys unicode.
Example:
```
ghci> Data.ByteString.Char8.pack "\9679"
"\207"
```
The return value of `JS.getResponseText` is overloaded to return something
of type `FromJSString result => Maybe result`.

There's no instance `FromJSString ByteString` in scope so the next best thing
is the `Text` instance.

This actually came up in my project and this patch fixed it.
@niteria
Copy link
Author

niteria commented Jun 20, 2020

Tagging @phadej in case the notification went nowhere.

@mightybyte
Copy link

This bug just caused problems for me as well. Any chance we can get this merged?

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

Successfully merging this pull request may close these issues.

2 participants