This is what I tried so far,by modifying php.ini: default_charset = "utf-8"
This is how MySQL is configured:
mysql> show variables like '%char%';
+--------------------------+-----------------------------------------------+
| Variable_name | Value |
+--------------------------+-----------------------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | f:\wamp\bin\mysql\mysql5.0.45\share\charsets\ |
+--------------------------+-----------------------------------------------+
8 rows in set (0.00 sec)
But it doesn't work.
I've dumped the data,it is in utf-8 format before and after processing by PHP.
But after inserting into MySQL by PHP,
it becomes a big mess(through phpmyadmin),
The data became something like this after inserting into database:
江è‹çœ 江阴市 山观镇 西苑 æ–°æ‘
what's worse,the data become normal again after reading it from MySQL and showing on the page!
Can someone point out what's the real problem here?
The code are all things like:
$dml = "insert into profiles(accountId,name,thumbnail,sex,homeAddr,livingAddr,peoples,married,politicalStatus,qq,mobilePhone,telephone,homePage)
value($accountId,'{$_POST['name']}',{$_POST['thumbnail']},{$_POST['sex']},'{$_POST['homeAddr']}','{$_POST['livingAddr']}','{$_POST['peoples']}',{$_POST['married']},'{$_POST['politicalStatus']}',{$_POST['qq']},{$_POST['mobilePhone']},{$_POST['telephone']},{$_POST['homePage']})";
mysql_query($dml,$con);