Changes:
I have removed the SET CHARACTER SET line and kept the SET NAMES line and moved it
outside of the if clauses for simplicity.
In catalog/includes/functions/database.php and catalog/admin/includes/functions/database.php,
in the function tep_db_connect(), add the lines
// Added for oscommerce utf-8
mysql_query("SET NAMES 'utf8'");
before the line
return $$link;
Entire function:
function tep_db_connect($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $link = 'db_link') {
global $$link;
if (USE_PCONNECT == 'true') {
$$link = mysql_pconnect($server, $username, $password);
} else {
$$link = mysql_connect($server, $username, $password);
}
if ($$link) mysql_select_db($database);
// Added for oscommerce utf-8
mysql_query("SET NAMES 'utf8'");
return $$link;
}
Why I changed it:
It would appear that one should use either one or the other but not both.
Moreover, SET CHARACTER SET is similar to SET NAMES, but sets the connection character set
and collation to be those of the default database rather than the one you specify
which is probably *not* what you want. The way the original (below) was written,
the SET NAMES being second perhaps overrides the other.
I placed the charset in single quotes as shown on the dev.mysql.com site.
Sources :
http://dev.mysql.com/doc/refman/5.0/...onnection.html http://forum.alsacreations.com/topic...e-donnees.html
http://wiki.pooteeweet.org/MDB2/CharacterSet
More...





LinkBack URL
About LinkBacks









Bookmarks