I'm storing data in a database as utf8_unicode
I have upon connection I use
mysql_query("SET NAMES 'utf8'");
Although my data is not appearing properly and showing diamonds where there are special characters. The thing is if I remove
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
From my header the mysql retrieved data begins to display properly, although now all my other static website text is corrupted.
Does anyone have any idea what's going on? I was thinking it could be caused by double utf-8 encoding the mysql data.
Somehow running utf8_encode() on them fixed the issue, so I suppose they were not actually being utf 8 encoded when inserted into the database.
Are the values in the database originally encoded in utf-8, if not, try reinserting them.
The crucial setting is character_set_connection - make sure that it's set to utf8, too. Also have a look at the values of the settings
character_set_client
character_set_connection
character_set_database
character_set_results
character_set_server
and the character settings of the tables involved.