[Development] [RFO QTBUG-84739] QJsonValue::fromVariant containing QByteArray

Raul Metsma raul at metsma.ee
Thu Jul 2 07:53:11 CEST 2020

>> I assume people who put “true” binary data into their QByteArrays and
>> convert that to JSON would have pre-base64-encoded it manually already, to
>> avoid the data loss, so this is a surprising change for those that just use
>> it as a poor man’s string. 
> Agreed, anyone who needed to send binaries in the past would have encoded 
> somehow (base16, base64 or base64url), but they might have also already moved 
> it to QString because that's what's documented. If they haven't -- and 
> QByteArray::toBase64 returns QByteArray -- then we get double encoding, which 
> is wore.
Thats what is happening here
https://github.com/open-eid/chrome-token-signing/issues/168 <https://github.com/open-eid/chrome-token-signing/issues/168>
Maybe QByteArray::toHex/Base64 should then return QString instead?

> In a green field scenario, the new behaviour is quite useful. You don't need 
> to pre-encode, the converter will do it for you.
We need then specify how it will then encoded (hex or base64) then.

Raul Metsma

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20200702/0fab34be/attachment.html>

More information about the Development mailing list