Topic
#terminal
1 piece
String length is not display width: the CJK bug hiding in tables and terminals
A CJK character like 生 is one code point but fills two columns in a monospace terminal. Code that budgets, truncates, or aligns text by character count instead of display width overflows the moment the text is Japanese, Chinese, or Korean. Measure with a width function — runewidth in Go, unicode-width in Rust, wcwidth in Python, string-width in JS — not len, .length, or rune count.