QWebView not displaying unicode characters
Solved
General and Desktop
-
Hello,
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 dowebview->settings()->setDefaultTextEncoding("utf-8");
Still no success. Any thoughts?
Thanks,
Kumara -
@kumararajas
Did you tryview->settings()->setDefaultTextEncoding("utf-8");
-
Hi
I did mention in my post that, I have tried the same. (Aah! syntax typo).No success..
-
@kumararajas
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.