On Friday, 3 July 2020 05:16:11 PDT Arnaud Clère wrote:
> > [1] https://tools.ietf.org/html/rfc7049#section-4.1
>
> Even if non normative, these advices are useful and even more so when
> implemented in such wide-spread library as Qt, so if it can be opted-in, I
> would definitely prefer option c)
That advice applies about converting CBOR to JSON. Ever since I introduced
QCborValue, doing:
QCborValue(QByteArray("Hello")).toJsonValue()
resulted in
QJsonValue("SGVsbG8")
That will not change. You may call this surprising, but it's in line with
standards and is explicitly documented as such.
It's also the reason this change happened to QJsonValue, because we reused
QCborValue::fromVariant and then converted from that to JSON.
Also note that you can tell CBOR how to encode a byte array to JSON:
QByteArray hello("hello");
QCborValue(hello).toJsonValue();
// "SGVsbG8"
QCborValue(QCborKnownTags::ExpectedBase64, hello).toJsonValue();
// "SGVsbG8="
QCborValue(QCborKnownTags::ExpectedBase16, hello).toJsonalue();
// "48656c6c6f"
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel System Software Products
_______________________________________________
Development mailing list
[email protected]
https://lists.qt-project.org/listinfo/development