I am using c++/XMS on AIX for consuming incoming messages from MQ. Rightnow I have a need for converting the message from ISO8859-1 to UTF-8. I do the following.
======================================================
void iso2utf8( char* text_iso, char* text_utf8, int nLen)
{
cout << "Converting to UTF-8." << endl;
iconv_t ic;
ic = iconv_open("UTF-8", "ISO8859-1"); // iso->utf8
cout << "Size of text_iso" << sizeof(text_iso) << endl;
size_t il = nLen;
size_t ol = nLen;
cout << "Size of text_iso" << ol << endl;
iconv(ic , &text_iso, &il, &text_utf8, &ol);
iconv_close(ic);
cout << "Message in UTF-8: " << text_utf8 << endl;
return;
}
======================================================
After conversion, when I save the message into a file, I get back the ISO8859-1 message. Any tips on how to solve this. I use fstream to write to file.