I've got a (sign) UTF8 problem. This is what's going on:
The database is over 6 or 7 years old. I'm bringing the site back to life but I'm having bad luck with UTF8 encoding. Edit EDIT: After having another stab I managed to make most of the characters work, for instance Grüßgott now works. However I am still get black diamonds on curly single and double quotes.
I've done a bunch of stackoverflow searching and tried a lot of things.
The local dev database I'm working on is setup with UTF8 and utf8_general_ci. I've manually converted each table from latin1_general_ci_as to utf8_general_ci and changed the chartset to UTF8 as well. Some of them didn't work with a query so I manually went to table design and then that seemed to fix it. I realise some table COLUMNS can (and in my care) are set to latin1_general_ci_as, but I've doing a test case with 1 specific piece of code, and that (blog) is definitely UTF8.
The database connection is setup as follows:
$connection = mysql_connect($DB_SERVER, $DB_USER, $DB_PASS); mysql_query("SET character_set_results=utf8", $connection); mb_language('uni'); mb_internal_encoding('UTF-8'); mysql_select_db($DB_NAME, $connection); mysql_query("SET names 'utf8'",$connection);
The site is procedual PHP. In the functions.php file it selects the data from the database, as an example see below. The only reason I'm show this is in my readings I saw some people saying you need to set something every single time, but I'm really hoping you don't need to declare something every time you want to grab something from the database.
query("SELECT * FROM table_name WHERE data='$something[unique]'");
The site is HTML5, and I have this in the header.php. As far as I can tell this is all okay.
<? header('Content-Type: text/html; charset=utf-8'); ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8">
So, that's where I am. I would really like to solve the problem once and for all and not have to worry about it again. Any help or ideas is greatly appreciated.