All pastes #173690 Raw Edit

Miscellany

public cpp v1 · immutable
·published 2006-09-17 05:17 UTC
rendered paste body
    205 void koi8_to_utf8(std::string& str)    206 {    207         char in[2];    208         char out[5];    209         sprintf(in, "%s", str.c_str());    210     211         const char* inbuf = in;    212         char* outbuf = out;    213         size_t inbytes = 2;    214         size_t outbytes = 5;    215     216         iconv_t icv = iconv_open("UTF8", "KOI8-R");    217         iconv(icv, &inbuf, &inbytes, &outbuf, &outbytes);    218         iconv_close(icv);    219     220         str.clear();    221         str = out;    222 }