Unicode Character Widths
Q: How do you determine how many terminal columns a string will take?
A: It is not possible, because it is not standardized for every character! But you can achieve good results with EastAsianWidth.txt, Unicode’s general categories and other data.
The unicode-display_width gem has reached 1.0. This is a major update with a far better width detection. Related news: The wcswidth gem offers FFI bindings to libc’s wcswidth
for character width detection (which is often a little outdated, but a good option if you don’t like the Ruby based one)
Post a comment