[Interest] make qjsondocument recognize utf8 as utf8

Boudewijn Rempt boud at valdyas.org
Thu Dec 31 12:36:07 CET 2015


I'm trying to build on CentOS 6.7 with Qt 5.5.1 from epel. I've got a bunch of json files that are valid, and are valid utf-8. Less and vi have no trouble showing the contents, but Qt's qjsondocument does, which means moc has a problem attaching the metadata to my plugin:

/krita/krita/plugins/formats/tiff/kis_tiff_import.cc:33: Warning: Plugin Metadata file "krita_tiff_import.json" does not contain a valid JSON object. Declaration will be ignored

A simple json validator gives the same result:

#include <QCoreApplication>
#include <QJsonDocument>
#include <QBuffer>
#include <QByteArray>
#include <QFile>
#include <QDebug>
#include <QJsonParseError>

int main(int argc, char *argv[])
{
         QCoreApplication a(argc, argv);
         QFile f(a.arguments()[1]);
         f.open(QFile::ReadOnly);
         QByteArray ba = f.readAll();
         f.close();
         QJsonParseError error;
         QJsonDocument d = QJsonDocument::fromJson(ba, &error);
         if (d.isNull()) {
                 qDebug() << "Invalid" << error.errorString();
         }
         else {
                 qDebug() << "Valid";
         }

}

There's a bunch of env variables set, but obviously, I'm missing one:

LANG=nl_NL.UTF-8
LC_ADDRESS=nl_NL.UTF-8
LC_ALL=nl_NL.UTF-8
LC_CTYPE=nl_NL.UTF-8
LC_IDENTIFICATION=nl_NL.UTF-8
LC_MEASUREMENT=nl_NL.UTF-8
LC_MONETARY=nl_NL.UTF-8
LC_NAME=nl_NL.UTF-8
LC_NUMERIC=nl_NL.UTF-8
LC_PAPER=nl_NL.UTF-8
LC_TELEPHONE=nl_NL.UTF-8
LC_TIME=nl_NL.UTF-8

But I'm at a loss to figure out which one. When I try the same thing on Ubuntu 15.10, everything works, of course.

-- 
Boudewijn Rempt | http://www.krita.org, http://www.valdyas.org
-------------- next part --------------
{
    "KPlugin": {
        "Name": "Tangent Normal Brush",
        "Name[ca at valencia]": "Pinzell de tangent normal",
        "Name[ca]": "Pinzell de tangent normal",
        "Name[en_GB]": "Tangent Normal Brush",
        "Name[es]": "Pincel normal de tangente",
        "Name[et]": "Puutuja normaali pintsel",
        "Name[gl]": "Pincel de tanxente e normal",
        "Name[it]": "Pennello normale tangente",
        "Name[nl]": "Rakend normaal penseel",
        "Name[pl]": "Styczny normalny pędzel",
        "Name[pt]": "Pincel da Normal à Tangente",
        "Name[pt_BR]": "Pincel da normal à tangente",
        "Name[sk]": "Tangenciálny normálny štetec",
        "Name[sv]": "Tangensnormalpensel",
        "Name[uk]": "Дотичний нормальний пензель",
        "Name[x-test]": "xxTangent Normal Brushxx",
        "ServiceTypes": [
            "Krita/Paintop"
        ]
    },
    "X-Krita-Version": "28"
}


More information about the Interest mailing list