67 inbytesleft = strlen(inputbuf);
69 cd = iconv_open(
"UTF-8", fromcode);
70 if ( cd == ((iconv_t)(-1)) )
73 outbytesleft = inbytesleft * 3 + 1;
75 *outputbuf = (
char *)
malloc(outbytesleft);
79 memset(*outputbuf, 0, outbytesleft);
80 outputptr = *outputbuf;
83 if ( iconv(cd, &inputbuf, &inbytesleft, &outputptr, &outbytesleft) == (
size_t)-1 )
88 iconvctl(cd, ICONV_SET_TRANSLITERATE, &on);
89 if ( iconv(cd, &inputbuf, &inbytesleft, &outputptr, &outbytesleft) == -1 )
92 iconvctl(cd, ICONV_SET_DISCARD_ILSEQ, &on);
93 if ( iconv(cd, &inputbuf, &inbytesleft, &outputptr, &outbytesleft) == -1 )