Details
-
Type:
Bug
-
Status: Closed
-
Priority:
P2: Important
-
Resolution: Done
-
Affects Version/s: 6.2.0
-
Fix Version/s: 6.3.0 Alpha
-
Component/s: Core: QString and Unicode, Documentation
-
Labels:None
-
Platform/s:
-
Commits:a43dd9a6b1b1218a4c39943ba349416265ab8c68 (qt/qtbase/dev)
Description
With Qt5, the following code will return 3, but with Qt6 it returns 6:
QString(QByteArray("foo\0\0\0", 6)).size()
The documentation of QString(QByteArray) still says this:
Stops copying at the first 0 character, otherwise copies the entire byte array.
But it looks like that's not true anymore since QByteArrayView was introduced.
QString::fromUtf8 and QString::fromLatin1 also do this, but the documentation isn't clear about the correct behavior.