GingJan / mysqlicious

Automatically exported from code.google.com/p/mysqlicious
0 stars 1 forks source link

Accents broken in the database #3

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

I had a problem with broken accents in the database.
Delicious outputs in UTF8 just fine, but for some reason, accents were broken, 
even with the database in utf8_general_ci.

I forced the collation in the code.

Here's the patch :

--- MySQLicious.old.php 2010-12-28 17:54:03.000000000 +0100
+++ MySQLicious.php 2010-12-28 17:50:36.000000000 +0100
@@ -118,6 +118,9 @@

        // connect to the MySQL server and select the database
        $this->mysqlLink = mysql_connect($mysqlHost, $mysqlUsername, $msyqlPassword) or die("Could not connect to MySQL server.");
+       mysql_query("SET NAMES 'UTF8'", $this->mysqlLink);
+       mysql_query("SET CHARACTER SET 'UTF8'", $this->mysqlLink);
+       mysql_query("SET COLLATION_CONNECTION='utf8_general_ci'", $this->mysqlLink);
        $db = mysql_select_db($mysqlDatabase, $this->mysqlLink) or die("Could not select specified database ($mysqlDatabase).");

    }

Original issue reported on code.google.com by sebastien.wains on 28 Dec 2010 at 4:59