Instead of transcoding directly between IText and IString objects, you can use pointer-based functions, based on the ANSI C++ Standard codecvt functions, that directly manipulate char* and UniChar* data. For example, to convert from char* data into Unicode:
For example, this code shows how to transcode a char string into Unicode:
const char* ansiText1 = "An ISO-8859-1 string."; ITranscoder* transcoder = ITranscoder::createTranscoder("ISO- 8859-1"); UniChar unicodeText[BUFSIZE]; char* ansiText1_next = NULL; UniChar* unicodeText_end = unicodeText+BUFSIZE; UniChar* unicodeText_next = NULL; // Transcode the string ITranscoder::result res = transcoder->toUnicode(ansiText1, ansiText1+strlen(ansiText1), ansiText1_next, unicodeText, unicodeText_end, unicodeText_next); if (res == codecvt_base::ok) { // Transcoding was successful } delete transcoder;
Transcoding Classes
Transcoder Names