We need to hang onto the internal state of the utf16 converter
object whenever converting a long string to unicode. This was
failing with the text stream class -- the first read was okay,
but subsequent reads could not be correctly converted to unicode.
Change-Id: I9e2d445d51c9009591bfa7a1765ea2d09ae634a2
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
}
} while (inBytesLeft != 0);
- QString s = utf16Codec->toUnicode(ba.constData(), ba.size() - outBytesLeft);
+ QString s;
if (convState) {
+ s = utf16Codec->toUnicode(ba.constData(), ba.size() - outBytesLeft, &state->internalState);
+
convState->invalidChars = invalidCount;
convState->remainingChars = remainingCount;
} else {
+ s = utf16Codec->toUnicode(ba.constData(), ba.size() - outBytesLeft);
+
// reset state
iconv(state->cd, 0, &inBytesLeft, 0, &outBytesLeft);
}
public:
IconvState(iconv_t x);
~IconvState();
+ ConverterState internalState;
char *buffer;
int bufferLen;
iconv_t cd;