Issue with printing Korean character using UTF-8



  • Hi All,

    I have an issue with printing Korean character. my sample code is

    @
    //! I have given the input to QPlaintextEdit as 세 - where the codePoint is 49464 ( \uC138 ) and We can type this character using key t+p after changing the keyboard layout to Korean language.

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

    QString str = ui->plainTextEdit->toPlainText().trimmed();
    qDebug()<<"Value="<<str;

    QByteArray ba = str.toUtf8();
    qDebug()<<"ba="<<ba;
    @

    Output:
    Value=(Non-printable character) 세
    ba=(Non-printable character) 세

    //! But If I watch the values on watch window ( Debug mode) it shows the value as "\140470" for str and "\354\204\270" for ba

    Please provide your valuable input.

    Note:
    I am using Qt 4.8.0, QtCreatot 2.4.1

    Thanks


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.