haskell-servant / haskell-servant/servant-jsaddle

Decode is not unicode aware

Open
#9 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
3
Forks
14
PR merge metrics
No merged PRs in 30d

Description

See this example program: https://github.com/kaol/servant-jsaddle-bug1

The unicode snowman will be turned into 0x03 instead of ☃ as expected. This will fail with a decode error. The UTF-16 representation of a snowman is 0x2603 which apparently gets truncated to only the least significant byte. For reference, the UTF-8 would encoding is 0xE2 0x98 0x83.

I tried to follow this bug to find out where it originates and seems like https://github.com/ghcjs/jsaddle-dom is a possible culprit. Specifically how `fromJSString` is implemented in it.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked example program and inspect the `fromJSString` implementation in the referenced `ghcjs/jsaddle-dom` project. Reproduce the snowman decoding failure, trace where its UTF-16 value is truncated, and verify that the example decodes ☃ without an error.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.