phpmysqlescapingmysql-real-escape-string

mysql_real_escape_string and ’


I'm using mysql_real_escape_string to escape a string before inserting it into my mysql database.

Everything's working fine, except that the character is getting missed and turned into ’ by mysql.

What can I do to get solve the problem? Should i be using a better function to escape the string?

I'm also worried that other charachters might be getting missed and being similarly turned into nonsense!

Please help!

Thanks :)


Solution

  • The character ’ is not getting missed, it is simply a character that is not used by mysql for encasing strings, and does not need to be escaped.

    The reason it is turning into that strange string is because it is a multi-byte character, and you are putting it into a single byte field.