Search code examples
phpmysqlreplacephpmyadminapostrophe

Apostrophe replaced by ’ in mySQL table


I'm a complete mySQL & PHP noob, and in my table, whenever there is an apostrophe, it gets replaced by ’. I've searched and found that it could be because my table is not UTF-8, but I changed all the collation settings in phpMyAdmin to utf8_unicode_ci, and I still get the ’.

To be clear, I am sending the data to a PHP script from an iPhone app using NSURLConnection. In the url it loads, the apostrophe is replaced by %E2%80%99. My server is running Linux.

Thanks for any help guys!


Solution

  • You have to make a query before storing data:

    SET NAMES utf8.

    Apparently it's mysql_set_charset('utf8',$conn) in 5.2+