Possible Duplicate:
UTF-8 all the way through
What my program does, is that on the client side, with the browser's encoding being UTF-8, the client types in some chinese into a textbox. This text is then transferred via jQuery $.post
to my server side. On the server, it is inserted into the database. When I first put it in, it became unreadable text. Next time, I tried to see where it went wrong, and outputted the server copy, and found that it was perfectly fine (perfectly readable Chinese text). So then I figured the problem must occur when the text was inserted into the database, somewhere in the SQL statement.
Is there a way to fix this error?
You have to set the charset of your DB to UTF-8 as well.
It happens because you have to set the charset to UTF too. If you have it set already then I assume you are working under windows and are trying to see the text in the MysqlWorkbench or something like that? I know this because I am chinese and used some chinese software and had the weird symbols everywhere xD.
Then you need to configure you OS to display those characters, in the control panel -> language and regional options or the keyboard options, sorry I don't remember the exact place cos I'm on a mac in the workplace.
It happens that the browsers can display those characters but the OS won't display those unless you set it.
Check this:
Specify character set to utf8 for the column in which you are saving unicode values.
Use VARCHAR(250) CHARACTER SET utf8
instead of VARCHAR(250)
ALTER TABLE tableName MODIFY ColumnName VARCHAR(250) CHARACTER SET utf8