Skip to content

fix(gist): preserve Unicode at title truncation boundaries - #4941

Open
dajiaohuang wants to merge 1 commit into
anuraghazra:masterfrom
dajiaohuang:fix-gist-unicode-title-w17-20261025
Open

dajiaohuang wants to merge 1 commit into
anuraghazra:masterfrom
dajiaohuang:fix-gist-unicode-title-w17-20261025

Conversation

@dajiaohuang

Copy link
Copy Markdown

A gist filename containing an emoji at the title truncation boundary leaves an isolated high surrogate in the generated SVG. For example, 34 ASCII characters followed by an emoji produce malformed Unicode when the header is sliced at 35 UTF-16 units. The same happens with show_owner=true when the owner/name header crosses that boundary.

Remove a trailing high surrogate from the truncated prefix before appending the ellipsis. This preserves the existing 35-unit limit and keeps emoji that fit completely within it.

Added three synthetic rendering regressions covering the filename boundary, owner/name boundary, and a fully fitting emoji. Before the fix, the Gist suite has 14 passing and 2 failing tests; afterward all 16 pass.

Validation on Linux with Node 22.14.0 (matching .nvmrc and CI): all 27 unit suites / 245 tests / 9 snapshots pass; lint, benchmark tests, full format check, and git diff --check pass. A preliminary Windows Node 24 run passed 244 tests and hit the existing rank floating-point assertion covered by #4639; no rank code or tests were changed. No live hosted cards, real provider data, or private tokens were used.

@vercel

vercel Bot commented Oct 24, 2026

Copy link
Copy Markdown

@dajiaohuang is attempting to deploy a commit to the github readme stats Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant