Question

I have a Sqlite database that has ClipArt tags in, we are translating that database to Swedish however my database query now does not return a result if the characters are non-English British.

For example, fisk == fish and that works perfectly, however öst == east but that fails.

I am constructing the query in a QString from a QLineEdit:

    sqlStatement += QString(" FileID IN (SELECT TLFileID FROM tblTags "
            " INNER JOIN tblTagLinks ON tagId = TLTagId "
            " WHERE tagLanguage LIKE '%1' "
            " AND (tagName LIKE '%2' OR tagName LIKE '%2s' "
            " OR tagLangSWEDISH LIKE '%2' "
            " OR tagLangFINNISH LIKE '%2' "
            " OR tagLangITALIAN LIKE '%2' ))").arg(defaultLanguage, tag);

and then converting it to a QSqlQuery:

qryFiles.prepare(sqlStatement);

if(!qryFiles.exec())

I know the database has the chars because I have been importing and exporting the data to CSV for the translators to translate, using a Sqlite admin tool and Excel.

Do I have to open the database in a special way?

I am using Qt 4.5.2, Windows XP, VS2008, Sqlite 3.5.1

Was it helpful?

Solution

I know it might be obvious, but did you check what character sets your db and your application use? I would guess that you're using native Windows coding in one and UTF8 in the other.

Sorry for the obvious answer, but that's the cause of most of my internationalization problems.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top