Originally Posted by
caduel
QString temp
= trUtf8
(qsOriginalStr.
toLatin1().
data());
QString temp = trUtf8(qsOriginalStr.toLatin1().data());
To copy to clipboard, switch view to plain text mode
well, it does not really make sense to convert a string into the Latin1 encoding and then tell trUtf8 to pretend that this really is UTF8 encoded data...
The original "string" should be either not a QString but only a QByteArray, or it should already be (as QStrings are) a unicode encoded string and no conversions should be needed.
Where does qsOriginalStr come from?
qsOriginalStr comes from mysql database. Here's the code:
MYSQL_ROW queryRow;
int queryFields = mysql_num_fields(pQueryResult);
while( (queryRow = mysql_fetch_row(pQueryResult)) != NULL )
{
printf("cSqlClient::cSqlQuery:next row\n");
for( i=0; i < queryFields; i++ )
{
qsOriginalStr
= QString(queryRow
[i
]);
MYSQL_ROW queryRow;
int queryFields = mysql_num_fields(pQueryResult);
while( (queryRow = mysql_fetch_row(pQueryResult)) != NULL )
{
printf("cSqlClient::cSqlQuery:next row\n");
for( i=0; i < queryFields; i++ )
{
qsOriginalStr = QString(queryRow[i]);
To copy to clipboard, switch view to plain text mode
This is the existing written by someone else. I think i can just replace
qsOriginalStr
= QString(queryRow
[i
]);
qsOriginalStr = QString(queryRow[i]);
To copy to clipboard, switch view to plain text mode
by
qsOriginalStr = (char *)(queryRow[i]);
qsOriginalStr = (char *)(queryRow[i]);
To copy to clipboard, switch view to plain text mode
and use trUtf8 directly on the (char *)
Bookmarks