walles/moar

[BUG] CJK charactors support?

CarterLi opened this issue · 6 comments

Simple command results in messy output

$ ps -ef | moar

image

It turns out to be caused by the CJK charactors 上午. If I use LANG=C ps -ef | moar it displayed normally

image

Reproduce: moar ps.txt

Thanks for the repro!

This could be possible to handle using something like https://github.com/mattn/go-runewidth to figure out string lengths.

No promises for a fix, but I want this to work.

... which seems to be based on this library: https://github.com/rivo/uniseg

wcwidth(3) can be used in C. Not sure about go though.

Unrelated note here, if you tend to use ps, I can recommend trying my ps replacement px:

https://github.com/walles/px

Released in https://github.com/walles/moar/releases/tag/v1.27.2.

And you should really try px :).