2

I am reading data from xml file. my xml file has city name like İstanbul. I check İstanbul in my city table by using select query. but when i echo my sql query in php it show the query in this formate

SELECT city_id FROM dc_city 
WHERE (name = 'İstanbul - Avrupa' OR FIND_IN_SET('İstanbul - Avrupa',like_names)) 
AND cultureid = 13

Illegal mix of collations (utf8_general_ci,COERCIBLE) and (latin1_swedish_ci,IMPLICIT) for operation 'find_in_set'

  • Your collations of your input string and the DB do not match. Try `FIND_IN_SET('İstanbul - Avrupa','a,b,c') collate latin1_swedish_ci` – juergen d Nov 29 '13 at 10:49

2 Answers2

0

You should change the charset/collation of your table. You have a table which stores its data in ASCII format when you try to filter it with UNICODE (UTF8) strings.

Have a look at this documentation to understand the matter.

To change the charset of a table :

ALTER TABLE dc_city CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
OlivierH
  • 3,875
  • 1
  • 19
  • 32
0
SET collation_connection = 'utf8_general_ci'

then for your databases

ALTER DATABASE db CHARACTER SET utf8 COLLATE utf8_general_ci

ALTER TABLE table CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci

MySQL sneaks swedish in there sometimes for no sensible reason.

Illegal mix of collations MySQL Error

Community
  • 1
  • 1
Suvash sarker
  • 3,140
  • 1
  • 18
  • 21