void utf8_to_ucs4(std::string const & utf8, docstring & ucs4)
{
+ static IconvProcessor iconv(ucs4_codeset, "UTF-8");
+
size_t n = utf8.size();
// as utf8 is a multi-byte encoding, there would be at most
// n characters:
// basic_string::data() is not recognized by some old gcc version
// so we use &(ucs4[0]) instead.
char * outbuf = (char *)(&(ucs4[0]));
- int bytes = iconv_convert(cd, ucs4_codeset, "UTF-8",
- utf8.c_str(), n, outbuf, maxoutsize);
+ int bytes = iconv.convert(utf8.c_str(), n, outbuf, maxoutsize);
// adjust to the real converted size
ucs4.resize(bytes/4);