Fixes QIconvCodec::convertToUnicode()
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>
This commit is contained in:
parent
fc24979e43
commit
72c0731122
@ -286,12 +286,16 @@ QString QIconvCodec::convertToUnicode(const char* chars, int len, ConverterState
|
||||
}
|
||||
} 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);
|
||||
}
|
||||
|
@ -87,6 +87,7 @@ public:
|
||||
public:
|
||||
IconvState(iconv_t x);
|
||||
~IconvState();
|
||||
ConverterState internalState;
|
||||
char *buffer;
|
||||
int bufferLen;
|
||||
iconv_t cd;
|
||||
|
Loading…
Reference in New Issue
Block a user