SPlatten SPlatten - 9 months ago 81
C++ Question

Qt translate escape sequence

I have:


I want to translate this for display into ºC

I'm using Qt 5.6, is there a built in function I can call to translate this sequence?

Qt has functions to translate the symbol to an escape sequence:

QString QString::toHtmlEscaped()

But what I need is the corresponding function to translate back to the original.


You can use QTextDocument or QTextDocumentFragment to decode html entities:

QString html_string = "ºC";
QString plain_string = QTextDocumentFragment::fromHtml(b).toPlainText();