I'm working with Symfony 2.3 and PostgreSQL 9.2. I just want to perform two simple queries, according to the value of a checkbox. Such queries are:
1) SELECT * FROM table WHERE field LIKE 'Something'
2) SELECT * FROM table WHERE field ILIKE 'Something'
As you know, the first is case sensitive, while the second is case insensitive. I know that in Doctrine ILIKE does not exist and that I should use the LOWER function. However, if I specify some special characters in the query (for example 'รจ'), I get an error when I use the case insensitive version (that is, when using the LOWER function).
In particular, the error I get is the following:
SQLSTATE[22021]: Character not in repertoire: 7 ERROR: invalid byte sequence for encoding "UTF8": 0xe3 0xa8 0x20
Everything works fine when I do not use the LOWER function. I already checked the encoding and it is UTF8 for both the database and the client_encoding parameter of PostgreSQL.
Any suggestion? Thank you