wcwidth() and wcswidth() and Latin vs. CJK character width

Alexey Dokuchaev danfe at nsu.ru
Sat Apr 3 06:34:28 UTC 2021


On Fri, Apr 02, 2021 at 04:51:49PM -0400, Ed Maste wrote:
> On Wed, 24 Mar 2021 at 10:37, Alexey Dokuchaev via freebsd-hackers
> wrote:
> > I've been wondering if there's anything like Markus Kuhn's
> > implementation* in our base libraries for $subj (my quick naive
> > search didn't turn up any results).  If yes, could someone point
> > me at it?
> 
> Kuhn's implementation is in the kernel for teken
> (sys/teken/teken_wcwidth.h). But, wcwidth/wcswidth are available
> already in userland,

Our default wcwidth(3) does not seem to work as described, but then
I've found that Kuhn's code is also part of the libxo(3) which what
I should have probably used in the first place.

> is there some reason you are looking at Kuhn's implementation
> specifically?

I want to improve the "ifconfig wlan0 list scan" output, e.g. it
currently does not display SSIDs which are in Russian or CJK, but
conversion to libxo(3) would address both this problem and make
the output easily consumable by external tools.

./danfe


More information about the freebsd-hackers mailing list