QTextCodec::codecForHtml looks at the first 1024 bytes

The HTML 5 spec requires it, instead of only looking at the first 512.

Task-number: QTBUG-40383
Change-Id: Ie10cf8c745ed1a3402914e126a02bc43d5035fff
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
This commit is contained in:
Shawn Rutledge 2014-08-19 16:21:49 +02:00
parent dd6080ceac
commit f45efafacf

View File

@ -1045,7 +1045,7 @@ QTextCodec *QTextCodec::codecForHtml(const QByteArray &ba, QTextCodec *defaultCo
// determine charset // determine charset
QTextCodec *c = QTextCodec::codecForUtfText(ba, 0); QTextCodec *c = QTextCodec::codecForUtfText(ba, 0);
if (!c) { if (!c) {
QByteArray header = ba.left(512).toLower(); QByteArray header = ba.left(1024).toLower();
int pos = header.indexOf("meta "); int pos = header.indexOf("meta ");
if (pos != -1) { if (pos != -1) {
pos = header.indexOf("charset=", pos); pos = header.indexOf("charset=", pos);