mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 02:42:55 +00:00
fix regression since 0199f108f1
and cc7809a775
default fallback of QTextCodec::codecForUtfText() is Latin1 thus fallback has to be specified explicitly Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
e40a59ee1f
commit
88448f30b6
2 changed files with 6 additions and 11 deletions
|
@ -1385,11 +1385,9 @@ ushort QXmlStreamReaderPrivate::getChar_helper()
|
|||
return 0;
|
||||
}
|
||||
|
||||
codec = QTextCodec::codecForUtfText(rawReadBuffer);
|
||||
if (!codec) {
|
||||
// fallback to UTF-8 even for non-UTF data
|
||||
codec = QTextCodec::codecForName("UTF-8");
|
||||
}
|
||||
// fallback to UTF-8 even for non-UTF data
|
||||
QTextCodec *fallback = QTextCodec::codecForName("UTF-8");
|
||||
codec = QTextCodec::codecForUtfText(rawReadBuffer, fallback);
|
||||
Q_ASSERT(codec);
|
||||
decoder = codec->makeDecoder();
|
||||
}
|
||||
|
|
|
@ -1548,7 +1548,7 @@ QString QXmlInputSource::fromRawData(const QByteArray &data, bool beginning)
|
|||
d->encMapper = Q_NULLPTR;
|
||||
}
|
||||
|
||||
int mib = 106; // UTF-8
|
||||
int mib = 106; // fallback to UTF-8 even for non-UTF data
|
||||
|
||||
// This is the initial UTF codec we will read the encoding declaration with
|
||||
if (!d->encMapper) {
|
||||
|
@ -1556,11 +1556,8 @@ QString QXmlInputSource::fromRawData(const QByteArray &data, bool beginning)
|
|||
d->encodingDeclChars.clear();
|
||||
d->lookingForEncodingDecl = true;
|
||||
|
||||
QTextCodec *codec = QTextCodec::codecForUtfText(data);
|
||||
if (!codec) {
|
||||
// fallback to UTF-8 even for non-UTF data
|
||||
codec = QTextCodec::codecForName("UTF-8");
|
||||
}
|
||||
QTextCodec *fallback = QTextCodec::codecForMib(mib);
|
||||
QTextCodec *codec = QTextCodec::codecForUtfText(data, fallback);
|
||||
Q_ASSERT(codec);
|
||||
mib = codec->mibEnum();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue