> On Jun 12, 2018, at 6:56 PM, Richard Levitte <levi...@openssl.org> wrote:
> 
> Some implementations of the iconv library take the empty string as
> the locale-specific encoding, but that is in no way universal, and
> isn't specified in the standard:
> 
> http://pubs.opengroup.org/onlinepubs/009695399/functions/iconv_open.html
> 
> Using nl_langinfo() to get the locale-specific encoding will, as far
> as I know, always get you what you expect.

On FreeBSD, after (required) calling:

        setlocale(LC_CTYPE, "");

The nl_langinfo(CODESET) returns the correct charset for by
UTF-8 terminal emulator for which my environment has:

        LC_CTYPE=en_US.UTF-8

With that, iconv_open() and iconv() behave correctly converting
to from ISO-8859-1 and UTF-8 (minimal tests).  Without the
setlocale() call, my encoding is always US-ASCII, and iconv
is naturally crippled.

-- 
        Viktor.

_______________________________________________
openssl-project mailing list
openssl-project@openssl.org
https://mta.openssl.org/mailman/listinfo/openssl-project

Reply via email to