I'm sure of the text is encoded correctly in UTF8, in PHP it shows if I use the following line at the beginning of the page
<?php header("Content-type: text/html; charset=utf-8");
and then I use code directly, and everything works out fine.
This is how my Qt code looks like, and I still dont have the correct result, if you can see something that I'm missing, please point it out to me.
Thanks
bool ret = query.exec("SET NAMES 'utf8'");
if(ret)
qDebug() << "true1";
else
qDebug() << query.lastError().text();
ret = query.exec("SET CHARACTER SET 'utf8'");
if(ret)
qDebug() << "true2";
else
qDebug() << query.lastError().text();
ret = query.exec("select name_searchword from searchword where id_company = 1125");
while(query.next())
{
QString st
= query.
value(0).
toString();
qDebug() << "Str is :" << st;
}
QSqlQuery query(m_masterDatabase);
bool ret = query.exec("SET NAMES 'utf8'");
if(ret)
qDebug() << "true1";
else
qDebug() << query.lastError().text();
ret = query.exec("SET CHARACTER SET 'utf8'");
if(ret)
qDebug() << "true2";
else
qDebug() << query.lastError().text();
ret = query.exec("select name_searchword from searchword where id_company = 1125");
while(query.next())
{
QString st = query.value(0).toString();
qDebug() << "Str is :" << st;
}
To copy to clipboard, switch view to plain text mode
Bookmarks