QWebView not displaying unicode characters
I am not sure why QWebView is not displaying the unicode characters on the HTML page. HTML has the charset="utf-8" as well.
And I have also tried to do
Still no success. Any thoughts?
Did you try
I did mention in my post that, I have tried the same. (Aah! syntax typo).
Have you tried this http://doc.qt.io/qt-4.8/qtextcodec.html#setCodecForCStrings
Aww its removed in Qt5 http://doc.qt.io/qt-5/sourcebreaks.html
@Ratzz Hey! Thanks! Your post given me the clue to look at codec point of view.
Problem is fixed.
While reading the file, read with codec, so that there is no loss.
Here is the solution -
QFile file( fileName ); file.open( QIODevice::ReadOnly | QIODevice::Text ); QTextStream out( &file ); out.setCodec( "utf-8" ); QString myData = out.readAll();
This solves the problem of displaying unicode characters that present in HTML page.