Congratulations to our 2022 Qt Champions!

QT5 : no member named 'setCodecForTr' in QTextCodec



  • Hi,

    i copied my code from Qt 4.8.3 to Qt 5. i get error messagess on build.

    QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
        QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
    

    Error messagess:
    no member named 'setCodecForTr' in QTextCodec.
    no member named 'setCodecForCString' in QTextCodec.

    When i look inside QTextCodec.h file , i can not seet these (setCodecForTr and setCodecForCString) methods.

    How will i continue supporting multilanguage?


  • Lifetime Qt Champion

    Hi,

    Indeed it's explained here.

    As for your issue, the best thing to do is to save your sources directly in UTF-8.

    You can see why here.


Log in to reply