[openssl-project] To use or not use the iconv API, and to use or not use other libraries
Viktor Dukhovni
openssl-users at dukhovni.org
Wed Jun 13 02:39:05 UTC 2018
> On Jun 12, 2018, at 6:56 PM, Richard Levitte <levitte at 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.
More information about the openssl-project
mailing list