<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hello,</p>
<p>PyQt6.QtCore.QByteArray works faulty when copying the data from
another QByteArray or a bytes object containing a zero character
(\0) as oart of its contents. The resulting QByteArray only
contains the data up to the zero. See following examples.</p>
<p><b>PyQt5 (OK)</b>:<br>
>>> from PyQt5.QtCore import QByteArray<br>
>>> b=b'abc\0def'<br>
>>> b<br>
b'abc\x00def'<br>
>>> ba=QByteArray(b)<br>
>>> ba<br>
PyQt5.QtCore.QByteArray(b'abc\x00def')</p>
<p><b>PyQt6 (faulty)</b>:<br>
>>> from PyQt6.QtCore import QByteArray<br>
>>> b=b'abc\0def'<br>
>>> b<br>
b'abc\x00def'<br>
>>> ba=QByteArray(b)<br>
>>> ba<br>
PyQt6.QtCore.QByteArray(b'abc')</p>
<p><b>PySide6 (OK)</b>:<br>
>>> from PySide6.QtCore import QByteArray<br>
>>> b=b'abc\0def'<br>
>>> b<br>
b'abc\x00def'<br>
>>> ba=QByteArray(b)<br>
>>> ba<br>
PySide6.QtCore.QByteArray(b'abc\x00def')</p>
<p>This shows, that the issue is related to PyQt6 and not Qt6.</p>
<p>Regards<br>
Detlev<br>
</p>
<pre class="moz-signature" cols="72">--
Detlev Offenbach
<a class="moz-txt-link-abbreviated" href="mailto:detlev@die-offenbachs.de">detlev@die-offenbachs.de</a></pre>
</body>
</html>