Surrogate & grapheme JS open

cli-table3 splits surrogate pairs (emoji / CJK) when truncating wide text

fix: avoid splitting surrogate pairs when truncating wide characters

cli-table3 · cli-table/cli-table3

Symptom

cli-table3 truncates text by byte/code-unit count rather than code-point count, splitting surrogate pairs in emoji or supplementary CJK characters, producing mojibake in terminal table cells.

Minimal repro
Create a cli-table3 table with a column containing emoji (e.g., 🎉) or supplementary CJK characters; set a column width that truncates mid-emoji; output shows garbled characters.
Fix

Use a Unicode-aware splitter (spread operator or Array.from) to iterate code points rather than code units when truncating.

Fix PR → #cli-table3-surrogate-truncate

Also in: JavaScript

← all 93 entries