Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.9.1
-
None
-
1c0b69eac521fec074390c023be8b5a23e88dd50 (qt/qtbase/5.14)
Description
QString::fromUcs4() internally calls Utf32::convertToUnicode(), which defaults to detect endianess from the data (which eats leading BOM).
But QString::fromUcs4() always uses the machine endianess, so no header parsing is needed.
I suggest to call it with QTextCodec::IgnoreHeader flag set.
Test case:
uint chr = 0xFEFF;
qDebug << QString::fromUcs4(&chr, 1).toUtf8();
shows an empty QByteArray.