PHP / MySQL character encoding incompatible?
I'm having what I believe to be an encoding issue with a 开发者_开发技巧mysql connection from php, print shows the query fine, and if I run the printed query on phpmyadmin, it returns results, but comes back empty from my script, does anyone know where can I look to figure out what's going on?
this is the offending query:
SELECT id FROM categories WHERE name_es = 'Pédagogie / Enseignement' OR name_fr = 'Pédagogie / Enseignement'
the same query with different values for the WHERE clause (values without é or other non-english characters) work fine, that's why I think it's encoding-related.
Retrieving and printing these data from the database is working just fine
Thanks
[EDIT: I think the problem might be that I'm grabbing the text that I'm querying from an uploaded file as writing the exact same text into a search text input I have which generates the exact same query works fine]
[RESOLVED: This was apparently caused by a space character encoded weirdly. It printed fine, but a double-encoded print showed difference between the queries I talk about in the [edit]]
Try mysql_set_charset to see if it works. Also check 'MySQL connection collation' in phpMyAdmin for your database.
This was apparently caused by differently encoded whitespace.
精彩评论