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

Problem when dealing with 4 bytes encoded UTF-8 character

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 6.5.3
    • None
    • Android, Linux/X11

    Description

      #include <QDebug>
      #include <QByteArray>
      #include <QString>
      
      int main()
      {
          QByteArray ba1 = "鼷"; // 3 bytes encoded UTF-8 charater
          qDebug() << "1: byte count:" << ba1.size();
          QString str1 = ba1;
          qDebug() << "1: unicode char count:" << str1.size(); // Correct result.
      
          QByteArray ba2 = "𫚭"; // 4 bytes encoded UTF-8 charater
          qDebug() << "2: byte count:" << ba2.size();
          QString str2 = ba2;
          qDebug() << "2: unicode char count:" << str2.size(); // Wrong result. Should be 1.
      
          return 0;
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            solarisbin 远 姚
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes