I fixed this by using the following
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("GB18030"));
//gb18030 was the encoding of the data.
//then using a query to retrieve the data, and display like below
QString str
= query.
value(0).
toString().
toUtf8();
//this would show a correct encoding of the data!
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("GB18030")); //gb18030 was the encoding of the data.
//then using a query to retrieve the data, and display like below
QString str = query.value(0).toString().toUtf8(); //this would show a correct encoding of the data!
To copy to clipboard, switch view to plain text mode
Bookmarks