svn commit: r351413 - head/usr.bin/last

Eugene Grosbein eugen at freebsd.org
Fri Aug 23 10:38:29 UTC 2019


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.



More information about the svn-src-all mailing list