Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Aug 2019 17:38:00 +0700
From:      Eugene Grosbein <eugen@freebsd.org>
To:        cem@freebsd.org
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all <svn-src-all@freebsd.org>, svn-src-head <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r351413 - head/usr.bin/last
Message-ID:  <361cc2e7-fba5-d724-dcf0-3c4ae3a8ed6f@freebsd.org>
In-Reply-To: <CAG6CVpXFtrfrdTJporKx%2BBXif1%2BL-pH_WAzDN%2BB78yugTy7cCA@mail.gmail.com>
References:  <201908230125.x7N1PdTN070890@repo.freebsd.org> <CAG6CVpXFtrfrdTJporKx%2BBXif1%2BL-pH_WAzDN%2BB78yugTy7cCA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
23.08.2019 10:01, Conrad Meyer wrote:

> Should this be done more generally?  Last time I looked it seemed like
> libxo was completely locale-unaware and just assumed all input was
> UTF-8.  It might make more sense to have libxo take locale into
> account when formatting %s strings.

libxo is locale-aware but in its own quite peculiar way, as libxo(3) tells:

>      For strings, the 'h' and 'l' modifiers affect the interpretation of the
>      bytes pointed to argument.  The default '%s' string is a 'char *' pointer
>      to a string encoded as UTF-8.  Since UTF-8 is compatible with ASCII data,
>      a normal 7-bit ASCII string can be used.  "%ls" expects a "wchar_t *"
>      pointer to a wide-character string, encoded as 32-bit Unicode values.
>      "%hs" expects a "char *" pointer to a multi-byte string encoded with the
>      current locale, as given by the LC_CTYPE, LANG, or LC_ALL environment
>      variables.

I'd like it detect UTF-8 automatically instead with strcmp(nl_langinfo(CODESET), "UTF-8")
but I'm not going to hack libxo code myself as I'm not familiar with its design.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?361cc2e7-fba5-d724-dcf0-3c4ae3a8ed6f>