I learned something new today in php / mysql development:
I’m facing the same issue every now and then, for a mailinglist script i wrote which uses mysql as data storage.
Problem is, depending on the end user server configuration, special chars such as Ã©,Ã¨, Ãª, Ã« get wacked when saved in the database, as it sometimes is not set to use utf8.
What i’ve learned? You can avoid the problem by just setting the database connection to view any data being sent or retrieved as utf-8 by just opening the connection and then telling MySQL that it should set/handle all string type data as utf-8!
mysql_connect ( ‘localhost’, ‘user’, ‘pass’ );
mysql_query ( ‘SET NAMES utf8′ );
// now do your inserts and selects
You can also set this in your MySQL config file, so it’s automatically done at startup!
init-connect=’SET NAMES utf8’