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

Text function and emojis causes jsaddle errors in certain cases #144

Open
alexfmpe opened this issue May 25, 2024 · 1 comment
Open

Text function and emojis causes jsaddle errors in certain cases #144

alexfmpe opened this issue May 25, 2024 · 1 comment

Comments

@alexfmpe
Copy link
Contributor

Porting from obsidiansystems/obelisk#1055.
Happens with

  • jsaddle-warp-0.9.8.2 / ghc 8.10
  • jsaddle-warp-0.9.9.0 / ghc 9.6

Works:
text "👋 Contact Support"

and

text "👋"

Causes JSaddle Error:

text "👋" >> text "Contact Support"

JSaddle Error:

jsaddle Results decode failed : "{"tag":"BatchResults","contents":[215,{"tag":"Success","contents":[[],[{"tag":"ValueToStringResult","contents":"\udc4bContact Support"}]]}]}"
CallStack (from HasCallStack):
error, called at src/Language/Javascript/JSaddle/WebSockets.hs:103:50 in jsaddle-warp-0.9.8.2-DFAPM2CvatBGFm3L9xaA1B:Language.Javascript.JSaddle.WebSockets
@hsyl20
Copy link

hsyl20 commented May 29, 2024

👋 is encoded as:

  • UTF-32: 0001f44b
  • UTF-16: d83d dc4b
  • UTF-8: f0 9f 91 8b

So here it looks like we encode it to UTF-16 and then drop the first code unit (d83d). So in the end result instead of having "\u1f44bContact Support" we get "\udc4bContact Support".

Could you dump rule's rewrites with GHC's -ddump-rule-rewrites to see if a fusion rule in Data.JSString.Internal.Fusion fire?

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