Japanese character read from html file and show in QTextEdit
Hi
I am using Qt 4.8.7 on Windows. I have one Japanese HTML file, I have to read it using QTextStream's readAll() and display it into QTextEdit. But it show Garbage character and not actual Japanese character...
QFile file(FilePath);
file.open(QFile::ReadOnly | QFile::Text);
QTextStream in(&file);
QString strData = in.readAll();
m_pTextEdit->setText(strData);
But it show garbage character.. What am I doing wrong.
Thanks
Santosh
Re: Japanese character read from html file and show in QTextEdit
whatever u have done is wrong ..retry once again..add certain library fucntion and get into it..
refer this'
doc.qt.io/qt-5/qtexamplesandtutorials.html
Re: Japanese character read from html file and show in QTextEdit
Quote:
Originally Posted by
santosh.kumar
But it show garbage character.. What am I doing wrong.
First thing you should try is calling QTextEdit::setHtml() instead of setText() if the content is HTML.
Second, check that your file is encoded in UTF-8 or set a different codec on the QTextStream.
Cheers,
_