PDA

View Full Version :  appears in QTextBrowser



szisziszilvi
3rd March 2011, 08:52
Hi,
I have a QTextBrowser in my app, in which I post a html document with the "setHtml()" method. The problem is that there is always that srange "" at the top left corner.

The file is saved in UTF-8, and I have read something that it is some encoding problem, but I can't find the Qt solution. I've tryed to give a html declaration for this in the head, (<meta http-equiv="content-Type" content="text/html; charset=utf-8">), but it did not work.

szisziszilvi
4th March 2011, 08:21
guess what I found! :)
So the solution is: QString::fromUtf8


QFile qfi(path);
QString text;
if(qfi.open(QIODevice::ReadOnly | QIODevice::Text))
{
while(!qfi.atEnd())
{
text.append(QString::fromUtf8(qfi.readLine()));
}
}