Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-86873

QJsonDocument problem on chinese key

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.15.2, 6.0.0
    • 5.15.0, 5.15.1
    • Core: Other
    • None
    • Windows
    • f00d322f6701580f97f38794b83b0ec13973d177 90168f3efb91f247d33726772665fc84bb3e9f30 (qt/qtbase/5.15)

    Description

       

      //code
      #include <QJsonValue>
      #include <QJsonObject>
      #include <QJsonDocument>
      #include <QDebug>
      
      int main(int argc, char *argv[])
      {
          QString f_strTemp=QStringLiteral(R"({"测试1":1,"测试2":2,"地址":3,"测试4":4,"测试5":5})");
          QJsonDocument f_document=QJsonDocument::fromJson(f_strTemp.toUtf8());
          auto f_object=f_document.object();
          qDebug()<<f_object;
          auto f_keys=f_object.keys();
          for(auto f_key:f_keys)
          {
              qDebug()<<f_key<<f_object[f_key];
          }
          return 0;
      }

      in above code ,the output is like that:

      QJsonObject({"测试1":1,"测试2":2,"地址":3,"测试4":4,"测试5":5})
      "测试1" QJsonValue(null)
      "测试2" QJsonValue(null)
      "地址" QJsonValue(null)
      "测试4" QJsonValue(double, 4)
      "测试5" QJsonValue(double, 5)

      but if replace “地址” by "测试",there is no problem。

      this problem is founded in 5.15.0 and 5.15.1(msvc2019),but not founded in 5.12.9(2017) and 5.9.8(2015。

       

      Attachments

        For Gerrit Dashboard: QTBUG-86873
        # Subject Branch Project Status CR V

        Activity

          People

            thiago Thiago Macieira
            redcarp redcarp
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes