How to get libiconv on FreeBSD 10 convert utf-8 -> wchar_t ?
Tijl Coosemans
tijl at FreeBSD.org
Tue Oct 13 09:53:48 UTC 2015
On Tue, 13 Oct 2015 02:29:38 -0700 (MST) kora via freebsd-questions <freebsd-questions at freebsd.org> wrote:
> Hi there,
> I solved it.
> I didn't notice that wchar_t is system dependent !
>
> I wrote a helpermethod to return the correct wchar_t "tocode" / "fromcode"
> input for the iconv_open().
> Using it now works.
>
>
> #define WCHAR_32_LE "UTF-32LE"
> #define WCHAR_32_BE "UTF-32BE"
> #define WCHAR_16_LE "UTF-16LE"
> #define WCHAR_16_BE "UTF-16BE"
Yes, FreeBSD wchar_t is not UTF-32. If you are using UTF-32 now be
aware that functions like wprintf may not work. You may want to use
char32_t instead of wchar_t to prevent programming errors.
More information about the freebsd-questions
mailing list