Please nominate your Qt Champions for 2021!

Read output Terminal with QProcess

  • Hi,

    I try to read output of terminal with accent like this:

    //Read interface
        cmd = QString("netsh interface show interface");
        QStringList list1;
        qDebug() << list1;

    And my list1 =

    ("\r\n", "\uFFFDtat admin    \uFFFDtat          Type            Nom de l'interface\r\n", "-------------------------------------------------------------------------\r\n", "Activ\uFFFD         D\uFFFDconnect\uFFFD     D\uFFFDdi\uFFFD            Ethernet\r\n", "Activ\uFFFD         Connect\uFFFD       D\uFFFDdi\uFFFD            Connexion au r\uFFFDseau local* 13\r\n", "Activ\uFFFD         Connect\uFFFD       D\uFFFDdi\uFFFD            VirtualBox Host-Only Network\r\n", "Activ\uFFFD         Connect\uFFFD       D\uFFFDdi\uFFFD            VirtualBox Host-Only Network #2\r\n", "Activ\uFFFD         Connect\uFFFD       D\uFFFDdi\uFFFD            Wi-Fi\r\n", "Activ\uFFFD         D\uFFFDconnect\uFFFD     D\uFFFDdi\uFFFD            Ethernet 2\r\n", "\r\n")

    I don't know how reomve this \uFFFD normaly it's "é" char.

    Someone can help me to fix this ?


  • Hi,

    I would assume that the contents of list1 is correct, but that qDebug does not ise an encoding in the output.


  • Exactlly !!!!

    i have tried some QString::fromUtf8 ...

    But never accent :(

  • @Franckynos


    Your console output contains the local charset.
    You can try QString::fromLocal8Bit() instead of QString::fromUtf8().
    Like this:


  • I have already try this but \uFFFD is replace by \u201A

    Activ\u201A         D\u201Aconnect\u201A     D\u201Adi\u201A            Ethernet 2\r\n", "\r\n"

  • Lifetime Qt Champion

    @Franckynos What encoding is your terminal using?

  • Lifetime Qt Champion


    You might also see the qDebug behaviour change described here.

  • @SGaist thx your have right, i have the 5.5.0.

Log in to reply