Skip to content

fix(reativa): render special characters as real JS strings#21

Merged
brnrdog merged 1 commit into
mainfrom
claude/reativa-special-chars-7eqj3s
Jul 25, 2026
Merged

fix(reativa): render special characters as real JS strings#21
brnrdog merged 1 commit into
mainfrom
claude/reativa-special-chars-7eqj3s

Conversation

@brnrdog

@brnrdog brnrdog commented Jul 25, 2026

Copy link
Copy Markdown
Owner

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).

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
@brnrdog
brnrdog merged commit 2128ddf into main Jul 25, 2026
1 check passed
@brnrdog
brnrdog deleted the claude/reativa-special-chars-7eqj3s branch July 25, 2026 21:36
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