MySQL Forums
Forum List  »  Quality Assurance

Chinese characters treated as string-escape commands
Posted by: Zane Claes
Date: May 08, 2008 05:43PM

This is most unusual, and has stumped me for a long time now. I have been working with Chinese characters using PHP/MySQL for some time now. However, for whatever reason, this time I cannot seem to properly input the Chinese data. I have tried echo()ing the MySQL query in PHP and executing the query in a MySQL administration tool by copy and pasting, and it works fine. However, I have also tried hard-coding the Chinese in the php query statement (rather than passing them with a php variable) and that ALSO works fine. This leads me to suspect that somehow the PHP variable is encoded differently than how the MySQL DB wants the variable, which is leading the output to look fine, but the query to fail internally. That's my best guess.

Further checking reveals that the variable containing Chinese (which, again, can be printed to the screen fine) is being treated as an escape sequence of some sort my MySQL. That is to say, if I append some English to the front and back of the Chinese statement and run an update query with THAT variable, the result in the database is ONLY the "front" English - no Chinese or "back" english.

Unfortunately, I have no freaking clue how to fix this. Can anyone help?

Options: ReplyQuote

Written By
Chinese characters treated as string-escape commands
May 08, 2008 05:43PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.