Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Encoding problem with polish chars
Qt 6.12 LTS is out! See what's new in the release blog

Encoding problem with polish chars

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
6 Posts 3 Posters 2.2k 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.
  • K Offline
    K Offline
    Kaluss
    wrote on last edited by
    #1

    Hi ,
    lately I started to face strange problem:
    For e.g.:
    If I pass polish characters to combobox everything is ok and they are correctly displayed,
    but if I try to print them with qDebug() or save to file I get something like:
    qDebug() << "option oneąęŻŹ";
    console output: option oneaeZZ

    Any idea how to fix that?

    jsulmJ 1 Reply Last reply
    0
    • K Kaluss

      Hi ,
      lately I started to face strange problem:
      For e.g.:
      If I pass polish characters to combobox everything is ok and they are correctly displayed,
      but if I try to print them with qDebug() or save to file I get something like:
      qDebug() << "option oneąęŻŹ";
      console output: option oneaeZZ

      Any idea how to fix that?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Kaluss qDebug: this is probably just an issue with the font used in your console.
      Writing to file: how do you write the strings into the file.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • K Offline
        K Offline
        Kaluss
        wrote on last edited by
        #3

        Hi,

        QFile file("someFile.txt");
        if(file.open(QIODevice::WriteOnly | QIOdevice::Text))
        {
             QTextSTream out(&file);
             out << "option oneąęŻŹ";
             file.close();
        }
        
        jsulmJ kshegunovK 2 Replies Last reply
        0
        • K Kaluss

          Hi,

          QFile file("someFile.txt");
          if(file.open(QIODevice::WriteOnly | QIOdevice::Text))
          {
               QTextSTream out(&file);
               out << "option oneąęŻŹ";
               file.close();
          }
          
          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Kaluss You can try to set codec, see http://doc.qt.io/qt-5/qtextstream.html#setCodec

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • K Kaluss

            Hi,

            QFile file("someFile.txt");
            if(file.open(QIODevice::WriteOnly | QIOdevice::Text))
            {
                 QTextSTream out(&file);
                 out << "option oneąęŻŹ";
                 file.close();
            }
            
            kshegunovK Offline
            kshegunovK Offline
            kshegunov
            Moderators
            wrote on last edited by
            #5

            @Kaluss said in Encoding problem with polish chars:

            out << "option oneąęŻŹ";

            What about this:

            out << QString::fromUtf8("option oneąęŻŹ");
            

            Read and abide by the Qt Code of Conduct

            1 Reply Last reply
            1
            • K Offline
              K Offline
              Kaluss
              wrote on last edited by
              #6

              It's quite strange.

              It's saved normally when I set the codec QTextStream::setCodec("UTF-8"), but till now I didn't have to do that.
              Maybe Windows after update changed something in configuration.

              Does somone know how to enable those chars in Qt console?

              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
              • Unsolved