I'm trying to save French accents in my database, but they aren't saved like they should in the DB.
For example, a "é" is saved as "é".
I've tried to set my files to "Unicode (utf-8)", the fields in the DB are "utf8_general_ci" as well as the DB itself.
When I look at my data posted through AJAX with Firebug, I see the accent passed as "é", so it's correct.
Thanks and let me know you need more info!
解决方案
Personally I solved the same issue by adding after the MySQL connection code :
mysql_set_charset("utf8");
or :
mysqli_set_charset("utf8");
or the POO equivalent :
$mysqli_link->set_charset("utf8");
And sometimes you'll have to define the main php charset by adding this code :
mb_internal_encoding('UTF-8');
On the client HTML side you have to add the following header data :
In order to use JSON AJAX results (e.g. by using jQuery), you should define the header by adding :
header("Content-type: application/json;charset=utf8");
json_encode(
some_data
);
This should make the trick