Problem with filter on a QSqlRelationalTableModel when non latin characters
-
I apply a filter on a QSqlRelationalTableModel:
filter = "(articles.name LIKE '%" + searchText + "%')"; model->setFilter(filter);If search text is latin characters, the search result is fine.
But when I enter greek characters the search result is not correct.
How can I fix this?
Something like utf8 for the QSqlRelationalTableModel filter? -
Hi,
Which backend are you using ?
-
The problem when I enter non latin characters has something to do with upper and lower case (with non latin characters): when I enter text with different case than what is in the db, I get nothing. If I enter the text with the same case as in the db, the result is correct.
With latin no problem. -
I will create another field in this table where I will store the same data as the ones in the field 'name', but in lower case. So I 'll do my searches on this new field!
I think it's the easiest way.@Panoss said in Problem with filter on a QSqlRelationalTableModel when non latin characters:
I think it's the easiest way
Adding "COLLATE NOCASE IN" to your select query is easier...
-
@Panoss said in Problem with filter on a QSqlRelationalTableModel when non latin characters:
I think it's the easiest way
Adding "COLLATE NOCASE IN" to your select query is easier...
@jsulm said in Problem with filter on a QSqlRelationalTableModel when non latin characters:
@Panoss said in Problem with filter on a QSqlRelationalTableModel when non latin characters:
I think it's the easiest way
Adding "COLLATE NOCASE IN" to your select query is easier...
The "COLLATE NOCASE IN" is giving me an error:
'Execution finished with errors.
Result: near "ΙΝ": syntax error'So there is no "COLLATE NOCASE IN", only "COLLATE NOCASE".
Which works correctly only for latin characters.