I'm banging my head against the wall here since I can't get iconv_open() to work (in current pepper_canary).
I need to converst from UTF-8 to UTF-32 (stored in wchar_t string), UTF-32 to UTF-8, and UTF-16 to UTF-32. The UTF-16 conversion to UTF-32 is necessary because we have file formats which think that wchar_t is 2 bytes (as in Windows).
On Linux, OSX and emscripten I can use the following iconv_open calls for this:
iconv_open("UTF-32LE", "UTF-8");
iconv_open("UTF-8", "UTF-32LE");
iconv_open("UTF-32LE", "UTF-16LE");
This doesn't work in PNaCl with newlib (didn't test NaCl or glibc), instead the functions return -1, errno is set to 25 (ENOTTY), strerror(errno) says "Not a character device".
Looking at usr/include/newlib.h I first thought that UTF-32 simply isn't support, only UTF-8, UTF-16 and UCS-2, UCS-4 are mentioned there.
So I basically tried all combinations of the following strings:
UCS-4, UCS-2, UCS-4LE, UCS-2LE, ucs-4, ucs-2 (with and without le), ucs_4, ucs_2 (with and without le), ucs4, ucs2, utf8, utf-8, utf_8, etc etc, all without success.
So... did anyone have success with converting between UTF-8, UTF-16 and UTF-32 in PNaCl so far, and if not, are there alternatives (apart from writing a converter myself, which I'm almost ready to do).
Cheers & Thanks,
-Floh.