fix(reativa): render special characters as real JS strings#21
Merged
Conversation
Text carrying non-ASCII characters — em dashes, ellipses, the ✓/– markers in
the pricing table, the ⌃/⌄ carets, ⌘, ×, ©, ·, −, • — was written as UTF-8 byte
escapes in plain OCaml string literals ("\xe2\x80\x94"). An OCaml string is a
byte sequence and Melange emits it one byte per JS code unit, so the browser
received "â\x80\x94" and rendered mojibake instead of the intended glyph.
Every affected literal now uses Melange's js-quoted string ({js|—|js}), which is
rewritten into a real JavaScript string. The rewrite only applies in expression
position, so the pricing table's yes/no markers — previously matched as string
patterns — are bound once and compared instead; a js-quoted pattern would still
be the raw bytes and never match.
Also regenerates website/src/ReativaSource.res so the site's Reativa source view
shows the real characters rather than the escapes (the generated file was stale,
so this also picks up the 32 snippets added since it was last regenerated).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RYRAfogJSSU6pcex3rEr2x
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Text carrying non-ASCII characters — em dashes, ellipses, the ✓/– markers in the pricing table, the ⌃/⌄ carets, ⌘, ×, ©, ·, −, • — was written as UTF-8 byte escapes in plain OCaml string literals ("\xe2\x80\x94"). An OCaml string is a byte sequence and Melange emits it one byte per JS code unit, so the browser received "â\x80\x94" and rendered mojibake instead of the intended glyph.
Every affected literal now uses Melange's js-quoted string ({js|—|js}), which is rewritten into a real JavaScript string. The rewrite only applies in expression position, so the pricing table's yes/no markers — previously matched as string patterns — are bound once and compared instead; a js-quoted pattern would still be the raw bytes and never match.
Also regenerates website/src/ReativaSource.res so the site's Reativa source view shows the real characters rather than the escapes (the generated file was stale, so this also picks up the 32 snippets added since it was last regenerated).