Important: Please read the Qt Code of Conduct -

How to set correct text codec for Turkish characters

  • Hi,

    I am reading LineEdit with below code and send byteArray to SerialPort:

    QByteArray msg=ui->dataMessageSetLineEdit->text().toUtf8();

    but Actually I can not send like 'İ' ,'Ü','Ş' turkish characters.How can I solve this problem?
    I also tried in main.cpp:

    QLocale::setDefault(QLocale(QLocale::Turkish, QLocale::Turkey));
    QTextCodec::setCodecForLocale( QTextCodec::codecForName("UTF-8") );
    QTextCodec::setCodecForTr( QTextCodec::codecForName("UTF-8") );
    QTextCodec::setCodecForCStrings ( QTextCodec::codecForName("UTF-8") );

  • How can I solve this?

Log in to reply