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. Accentuation problems
Qt 6.11 is out! See what's new in the release blog

Accentuation problems

Scheduled Pinned Locked Moved General and Desktop
10 Posts 4 Posters 4.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.
  • D Offline
    D Offline
    dcbasso
    wrote on last edited by
    #1

    I'm trying to show some messages and texts on UI, but the messages appears with encoding errors. I try some stuff to fix it but nothing works.
    What should I do?
    I example code:

    @
    CaixaDialogo::getMensagemAviso("Modelo de Veículo não encontrado.")->show();
    @

    @
    QMessageBox* CaixaDialogo::getMensagemAviso(QString mensagem)
    {
    qDebug() << "Passou aqui!";
    QMessageBox* msgBox = new QMessageBox();
    msgBox->setText( mensagem );
    return msgBox;
    }
    @

    I try to use the QString::fromUtf8() and doesn't works.

    1 Reply Last reply
    0
    • B Offline
      B Offline
      broadpeak
      wrote on last edited by
      #2

      Maybe:

      @
      CaixaDialogo::getMensagemAviso(QString("Modelo de Veículo não encontrado."))->show();
      @

      QString is unicode aware.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dcbasso
        wrote on last edited by
        #3

        The problem persists...

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dmcr
          wrote on last edited by
          #4

          This is probably an encoding problem in your file.

          Try in QtCreator tools/options, then behavior in Text Editor
          select default encoding UTF-8.

          Then with some tools like notepad++, encode your file in utf8.
          The problem will be hopefully solved.

          dmcr

          1 Reply Last reply
          0
          • B Offline
            B Offline
            broadpeak
            wrote on last edited by
            #5

            This?:

            @
            CaixaDialogo::getMensagemAviso(QString("Modelo de Veículo não encontrado.").toUtf8())->show();
            @

            1 Reply Last reply
            0
            • D Offline
              D Offline
              dcbasso
              wrote on last edited by
              #6

              I'm using the Default, system etc...
              Appears to be UTF-8....

              I will try... I will need to use the "convmv".
              Every single file of my project will need to be converted? Could I change the setting, opening the files and saving then again and the QtCreator will change to UTF-8?!

              1 Reply Last reply
              0
              • D Offline
                D Offline
                dcbasso
                wrote on last edited by
                #7

                broadpeak, to toUtf8 change the errors only... still having problems with encoding...

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  dcbasso
                  wrote on last edited by
                  #8

                  dmcr, the file is already in UTF-8, see:

                  @
                  file -bi widgetms.cpp
                  text/x-c; charset=utf-8
                  @

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    dcbasso
                    wrote on last edited by
                    #9

                    This works... But I don't like... I need something easier and more "beautiful" to solve the problem:

                    @
                    CaixaDialogo::getMensagemAviso( QString::fromUtf8("Modelo de Veículo não encontrado.") )->show();
                    @

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      shanek
                      wrote on last edited by
                      #10

                      This looks like a localisable string, so you should probably use tr() and linguist.
                      See http://qt-project.org/doc/qt-4.8/linguist-manual.html

                      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