I am trying to insert simplified chinese into my mysql table using UTF8_unicode_ci
. Everything including the connection is configured to use UTF8.
When I try an insert these characters into the database table using a traditional HTML form post using PHP, I get the MySQL invalid string value error message. The strange thing is that if I use Jquery to post the information to another PHP page to store in the database, I get no error and the data goes in fine.
I am wondering what the differences are. Can anyone shed some light on this issue?
It happens for all data as far as i know. I connect to mysql using: $this->link = mysql_connect(cj_config::CJ_DB_HOST, cj_config::CJ_DB_USERNAME, cj_config::CJ_DB_PASSWORD);
and then select the appropriate database using mysql_select_db
.
The table collation is utf8_unicode_ci, and the column is also set to utf8_unicode_ci
. The database collation and connection are all set to Utf8
also.
The error i am getting when sending the html form post is :
Error: Incorrect string value: '\x9A' for column 'company_name' at row 1.
I don't get this error when posting the same chinese character via jquery post and mysql does not complain.
The source of this jquery post is below and looks properly utf8 encoded:
customer=7&task_title=%E5%95%8A&task_notes=%E5%95%8A&datetime=&method=addtaskg&smallview=true