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. Issue with printing Korean character using UTF-8
Forum Updated to NodeBB v4.3 + New Features

Issue with printing Korean character using UTF-8

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 658 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.
  • M Offline
    M Offline
    M_31
    wrote on last edited by
    #1

    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

    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