6 #define INTERNAL_ENCODING "UTF8"
8 static iconv_t cd_to_internal = (iconv_t) -1;
9 static char int_buf[MAXGEDCLINELEN*2];
11 int open_conv_to_internal(char* fromcode)
13 if (cd_to_internal != (iconv_t) -1)
14 iconv_close(cd_to_internal);
15 cd_to_internal = iconv_open(INTERNAL_ENCODING, fromcode);
16 return (cd_to_internal != (iconv_t) -1);
19 void close_conv_to_internal()
21 iconv_close(cd_to_internal);
24 char* to_internal(char* str, size_t len)
27 size_t outsize = MAXGEDCLINELEN * 2;
28 char *wrptr = int_buf;
30 memset(int_buf, 0, sizeof(int_buf));
31 iconv(cd_to_internal, &rdptr, &insize, &wrptr, &outsize);