Fix regression when pasting into QTextEdit from Firefox.
Return the codec if one was found by QTextCodec::codecForUtfText, instead of returning the default (UTF-8). Task-number: QTBUG-31293 Change-Id: I95e3260376c00537006b7fbfdc3df5850e1ba657 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
26ae24e20b
commit
964be00403
|
|
@ -1065,8 +1065,10 @@ QTextCodec *QTextCodec::codecForHtml(const QByteArray &ba, QTextCodec *defaultCo
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!c)
|
||||
c = defaultCodec;
|
||||
|
||||
return defaultCodec;
|
||||
return c;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -1917,6 +1917,17 @@ void tst_QTextCodec::codecForHtml_data()
|
|||
|
||||
html = "<!DOCTYPE html><html><head><meta charset=\" utf' 8 /><title>Test</title></head>";
|
||||
QTest::newRow("invalid charset, early terminator (')") << html << noDefault << fallback;
|
||||
|
||||
const char src[] = { char(0xff), char(0xfe), char(0x7a), char(0x03), 0, 0 };
|
||||
html = src;
|
||||
QTest::newRow("greek text UTF-16LE") << html << 106 << 1014;
|
||||
|
||||
html = "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"><span style=\"color: rgb(0, 0, 0); font-family: "
|
||||
"'Galatia SIL'; font-size: 27px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; "
|
||||
"line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: "
|
||||
"auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: "
|
||||
"none;\">ͻ</span>\000";
|
||||
QTest::newRow("greek text UTF-8") << html << 106 << 106;
|
||||
}
|
||||
|
||||
void tst_QTextCodec::codecForHtml()
|
||||
|
|
|
|||
Loading…
Reference in New Issue