Post

Replies

Boosts

Views

Activity

Reply to Wallet pass: JSON with binary content/unknown encoding
Thanks for the hint. I am using QT in my app, and before I did: QJsonParseError jsonErr; QByteArray contents = file.readAll(); auto doc = QJsonDocument::fromJson(contents, &jsonErr); Now after your hint I was able to do this, which seems to be working: QJsonParseError jsonErr; QByteArray contents = file.readAll(); QString utf32String = QString::fromUcs4((const uint*)contents.data()); auto doc = QJsonDocument::fromJson(utf32String.toUtf8(), &jsonErr); It still won't parse, because the JSON actually contains a trailing comma, which the Wallet app seems to ignore, but QJsonDocument not. What a pity, but thats another story. However the data seems to be readable now, when I dump the utf32String, I'll get: There is still some weird characters at the end, not sure what they are. (I had to add this as screenshot, because it would not add a reply here with those invalid characters) Is there any way I can detect that this is UTF-32 instead of UTF-8, other than the normal parsing failing & trying to parse again?
Aug ’21
Reply to Wallet pass: JSON with binary content/unknown encoding
Thanks for the hint. I am using QT in my app, and before I did: QJsonParseError jsonErr; QByteArray contents = file.readAll(); auto doc = QJsonDocument::fromJson(contents, &jsonErr); Now after your hint I was able to do this, which seems to be working: QJsonParseError jsonErr; QByteArray contents = file.readAll(); QString utf32String = QString::fromUcs4((const uint*)contents.data()); auto doc = QJsonDocument::fromJson(utf32String.toUtf8(), &jsonErr); It still won't parse, because the JSON actually contains a trailing comma, which the Wallet app seems to ignore, but QJsonDocument not. What a pity, but thats another story. However the data seems to be readable now, when I dump the utf32String, I'll get: There is still some weird characters at the end, not sure what they are. (I had to add this as screenshot, because it would not add a reply here with those invalid characters) Is there any way I can detect that this is UTF-32 instead of UTF-8, other than the normal parsing failing & trying to parse again?
Replies
Boosts
Views
Activity
Aug ’21