This is a discussion on Strange characters in MYSQL? within the MySQL Database forums, part of the Database Forums category; The following string: "US generals ‘will quit’ if Bush orders Iran attack" is being stored in my table ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
The following string:
"US generals ‘will quit’ if Bush orders Iran attack" is being stored in my table as: "US generals ‘will quit’ if Bushorders Iran attack" The only PHP function I'm applying to the string is mysql_real_escape_string, and that doesn't appear to be the root of the problem. I'm using utf8_general_ci as my collation. Forgive my ignorance. |
|
|||
|
matthud@gmail.com wrote:
> The following string: > "US generals ‘will quit’ if Bush orders Iran attack" > > is being stored in my table as: > > "US generals ‘will quit’ if Bush orders Iran attack" Thats how an UTF-8 string looks like when displayed with ISO8859-1. -- //Aho |
|
|||
|
> "US generals ‘will quit’ if Bush orders Iran attack"
> is being stored in my table as: > "US generals ‘will quit’ if Bush orders Iran attack" > > The only PHP function I'm applying to the string is > mysql_real_escape_string, and that doesn't appear to be the root of > the problem. I'm using utf8_general_ci as my collation. If you view the page in your browser, check if the browser selects utf-8 ("view" menu under IE and firefox). If not, then you can either convert the string (using the mb_string functions, for instance), or use utf-8 in both php and MySQL. You can set the encoding in PHP.INI. In MySQL, check the output of: SHOW VARIABLES LIKE 'char%' Best regards |