Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Avoid automatic entity encoding
i couldn't find any possibility or workaround to get the HTML source from a QWebView with preserved entities.
So i hope someone can point me to something i've overseen ;)
The problem is, when i set the HTML (containing entities) manually to the QWebView and try to retrieve later i get a QString with the entities encoded to their raw corresponding unicode characters.
prady_80 last edited by
I have not tried this,
Could you please check if this works?
text.setHtml(<The obtained HTML here>);
QString plain = text.toPlainText();
no this doesn't work either. Which would have surprised me ... since a QTextDocument doesn't even support the full HTML subset?
I'm working on a WYSIWYG editor and thus it's mandatory to preserve the entities which the user added to the document.
A easy work around would be to iterate over the whole source string and replace every contained QChar with QChar::unicode() > 255 to &#UNICODE and/or hold a list of the most common used entities.
I think that's the way i will have to go.