13 #include "Ecore_Txt.h"
14 #include "ecore_txt_private.h"
23 ecore_txt_convert(const char *enc_from, const char *enc_to, const char *text)
26 char *new_txt, *inp, *outp;
27 size_t inb, outb, outlen, tob, outalloc;
29 if (!text) return NULL;
30 ic = iconv_open(enc_to, enc_from);
31 if (ic == (iconv_t)(-1)) return NULL;
46 count = iconv(ic, &inp, &inb, &outp, &outb);
48 if (count == (size_t)(-1))
52 new_txt = realloc(new_txt, outalloc + 64);
53 outp = new_txt + outlen;
57 else if (errno == EILSEQ)
59 if (new_txt) free(new_txt);
63 else if (errno == EINVAL)
65 if (new_txt) free(new_txt);
71 if (new_txt) free(new_txt);
78 if (outalloc == outlen) new_txt = realloc(new_txt, outalloc + 1);