Reputation: 1744
I am getting the following error in MySQL:
Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='
this is in response to a query in my application:
SELECT count(1) as idExists
FROM user
WHERE userName = 'خالد'
As far as I understand, this is happening because the characters being entered are foreign to the collation type used for my table.
So my question is what collation should be used to handle this? The user table is currently set to UTF8 which I thought was the correct one, but obviously I'm wrong. Should it change to Latin1 or is there a better collation that handles all characters??
Thanks
Upvotes: 0
Views: 487
Reputation: 206929
You shouldn't use Latin1 if you want to be able to store Arabic (or Greek, Cyrillic, Japanese etc...). UTF-8 (or some other Unicode encoding) is the way to go.
Are you sure you table's username column doesn't have a collation set to it?
Upvotes: 1