Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.1.1
-
None
Description
If I want to copy a byte array that contains 0-bytes into a string using the method "QString::fromLatin1", the 0-byte ad the characters behind the 0-byte are cut off.
Example:
QString sInput = "426567696e00456e64"; // --> "Begin\0End"
QByteArray ba = QByteArray::fromHex(sInput.toLatin1());
QString sRes = QString::fromLatin1(ba); // --> DOES NOT WORK CORRECTLY
// --> sRes = "Begin"; "\0End" is missing !!!
Additional Info - following works:
QString::fromLatin1(ba.constData(), ba.size());