I moved data from MySQL 4 (they were originally set to latin2 encoding
) to MySQL 5 and set encoding to utf-8
. It
try query
SET NAMES utf8
before any query in your application
It doesn't seem like setting every SQL Database, Table, and Field to UTF-8 in MySQL and is good enough. Very annoying.
Ended up forcing the issue to solve encoding problems:
Had to use this Every place I open the database: $db->set_charset("utf8");
And that worked. Finally.
Here is a fix. Set the header to header ('Content-type: text/html; charset=utf-8');
Then print your content using utf8_decode($content)
. You must have the two to make it work.
Try setting the MySQL connection to UTF-8:
SET NAMES 'utf8'
And send explicit UTF-8 headers, just in case your server has some other default settings:
header('Content-type: text/html; charset=utf-8');