<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
On 2022-11-28 09:32, Yauheni Pervenenka via Interest wrote:<br>
<blockquote type="cite"
cite="mid:CAJavUxevU_K3KZP_+5dMQLrRFqAn8cT+ar6fHA==JrC78jyAYQ@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">Hi, Tony, thanks for your reply,<br>
OS: win 11<br>
DB: SQLite<br>
<br>
Unfortunately, QVariant::toByteArray returns size 52(hex 104),
QVariant::toString returns size 30<br>
<br>
There is data returned by QVariant::toByteArray::toHex<br>
Qt data in hex(size 104):<br>
763130492d46c2ab4cc29c7bc2b0efbfbd78c29b29c3ab1e4723dea6efbfbdefbfbdefbfbdefbfbd66c2a275efbfbdefbfbdc4a6<br>
<br>
Original value in hex
size(68): 763130492d46ab4c9c7bb0e9789b29c3ab1e4723dea6c8e5d2f9b266a275e1fbe4a6 <br>
<br>
there are some data that is parsed correct but time to time it
is broken<br>
<br>
<br>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Mon, Nov 28, 2022 at 11:17
AM Tony Rietwyk <<a href="mailto:tony@rightsoft.com.au"
moz-do-not-send="true" class="moz-txt-link-freetext">tony@rightsoft.com.au</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi
Yauheni,<br>
<br>
You don't say which type of database you are using? There may
be issues <br>
with the database client library altering the blob to UTF8.
Though I <br>
would expect the python code using the same client to have the
same <br>
problem.<br>
<br>
Assuming that QVariant has the byte array unaltered, then <br>
QVariant.toByteArray().length() should give 34. Using
qstrlen, suggests <br>
that you are using QVariant.toString instead. To print the
hex you <br>
should just use QVariant.toByteArray().toHex().<br>
<br>
Hope that helps,<br>
<br>
Tony<br>
<br>
<br>
On 28/11/2022 6:46 pm, Yauheni Pervenenka via Interest wrote:<br>
> Hello, community<br>
> I have faced with issue that qvariant using qstrlen for
getting data <br>
> size, but sometimes it returns wrong size especially for
BLOB data(if <br>
> there are some special symbols), are there any way to get
data correct?<br>
><br>
> Note:<br>
> Database value 34, python returns correct data size, but
<br>
> qvariant::toByteArray returns 52<br>
><br>
> Python data and Database data in hex(size <br>
>
68): 763130492d46ab4c9c7bb0e9789b29c3ab1e4723dea6c8e5d2f9b266a275e1fbe4a6<br>
><br>
> Qt data in hex(size 104):<br>
>
763130492d46c2ab4cc29c7bc2b0efbfbd78c29b29c3ab1e4723dea6efbfbdefbfbdefbfbdefbfbd66c2a275efbfbdefbfbdc4a6<br>
><br>
</blockquote>
</div>
</blockquote>
<br>
Hi, most of the data is preserved in Qt but some other data is
injected midstream.<br>
Just a guess, but maybe the Qt version has a multithreading issue,
like two threads are settings values in the same array at the same
time.<br>
<br>
<br>
<br>
</body>
</html>