Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Unicode: setCodec("UTF-32le") not pairs surrogates
Forum Updated to NodeBB v4.3 + New Features

Unicode: setCodec("UTF-32le") not pairs surrogates

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 1 Posters 424 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AndrzejB
    wrote on last edited by AndrzejB
    #1

    Unicode map 20000-20FFF

    #include <QFile>
    #include <QTextStream>
    #include <random>
    
    using namespace std;
    
    int main(int argc, char *argv[])
    {
        mt19937 gen(0);
        unsigned int ui[1000];
        uniform_int_distribution<unsigned int> dis(0x20000, 0x20fff);
        for (int i=0; i<1000; i++)
            ui[i] = dis(gen);
        QString extstr = QString::fromUcs4(ui,1000);
        printf("%d\n",extstr.length());
        QFile file("h:\\res\\eutf32le.txt");
        file.open(QIODevice::WriteOnly | QIODevice::Text);
        QTextStream out(&file);
        out.setCodec("UTF-32le");
        out.setGenerateByteOrderMark(false);
        out << extstr;
        file.close();
    }
    

    File size = 8000 bytes instead 4000 like ui table.
    For utf16->utf8 is OK.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AndrzejB
      wrote on last edited by
      #2

      I check this file and from half is junk, first half seems to be good.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved