/* FIXME: Need to ensure that this char is valid in the target encoding */
const char fallbackchar = '?';
+ if ( text == NULL )
+ return NULL;
+
if ( length == -1 )
length = strlen(text);
inbytes = length;
do {
-
-
result = iconv(convertor[how], &ip, &inbytes,
&op, &outbytes);
}
}
-
} while ( -1 == result );
+ if (outbytes == 0 )
+ {
+ char *const oldaddr = outbuf;
+ outbuf = xrealloc(outbuf, outbufferlength + 1);
+
+ op += (outbuf - oldaddr) ;
+ }
+
*op = '\0';
-
return outbuf;
}