How to convert from HTML-encoded to QString UTF8?



  • Hi there,
    I wanna convert an HTML-encoded string into a QString to present it to the user.
    In Qt 4.8 I could do it this way:

    @qDebug() << "Result: " << resultName; // Returns this "사파아"

    QTextDocument qDoc;
    qDoc.setHtml(resultName);
    resultName = qDoc.toPlainText();

    qDebug() << "Result: " << resultName; // This should return "사파아" but it returns "???"@

    But when using this on Qt 5.3.1 it returns "???" instead of the proper "Korean" text!
    Where's the problem?!


  • Moderators

    Maybe your terminal does not support UTF-8? Try displaying the text in a QLabel.


Log in to reply
 

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