Discussion:
wcwidth() and wcswidth() and Latin vs. CJK character width
Alexey Dokuchaev via freebsd-hackers
2021-04-01 11:28:10 UTC
Permalink
Hi there,
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? If no, how feasible would
it be to add Markus' code to our libc or perhaps some ancillary library?
So I guess lack of replies mean "please go ahead". :-)

Before I open a DR for adding wcwidth.c to libutil, how do we handle single
3rd-party files, last modified in 2007? :) Just add them as is, apply any
necessary changes, and commit (together with the manpage), or they must go
through the vendor area like other contributed software?

./danfe
Ed Maste
2021-04-02 20:51:49 UTC
Permalink
On Wed, 24 Mar 2021 at 10:37, Alexey Dokuchaev via freebsd-hackers
Hi there,
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, is there some reason you are looking at Kuhn's
implementation specifically?
Alexey Dokuchaev via freebsd-hackers
2021-04-03 06:34:23 UTC
Permalink
Post by Ed Maste
On Wed, 24 Mar 2021 at 10:37, Alexey Dokuchaev via freebsd-hackers
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.
Post by Ed Maste
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
Yuri Pankov
2021-04-03 10:22:50 UTC
Permalink
Post by Alexey Dokuchaev via freebsd-hackers
Post by Ed Maste
On Wed, 24 Mar 2021 at 10:37, Alexey Dokuchaev via freebsd-hackers
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.
Post by Ed Maste
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.
I think this could be easily fixed by adding setlocale(LC_ALL, "") call
to ifconfig's main(), wcwidth() won't work properly without correct
locale set (at least, without LC_CTYPE).

Loading...