Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Apr 2021 13:22:50 +0300
From:      Yuri Pankov <yuripv@yuripv.dev>
To:        Alexey Dokuchaev <danfe@nsu.ru>, Ed Maste <emaste@freebsd.org>
Cc:        hackers@freebsd.org
Subject:   Re: wcwidth() and wcswidth() and Latin vs. CJK character width
Message-ID:  <a3e3d32c-de37-01a4-03ff-081f12823160@yuripv.dev>
In-Reply-To: <20210403063423.GA50619@regency.nsu.ru>
References:  <20210324143117.GA61738@regency.nsu.ru> <CAPyFy2Aw6BTyuG_6Fd8a9yMCa3kstLuxx_nBM474ftsMe4_YWw@mail.gmail.com> <20210403063423.GA50619@regency.nsu.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
Alexey Dokuchaev via freebsd-hackers wrote:
> 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.

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).



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a3e3d32c-de37-01a4-03ff-081f12823160>