Community Add-Ons

Add file to this package
Top » Other

Corrupted character on mysql with utf-8
for osCommerce Online Merchant v2.2

I am using the osCommerce RC2 with Greek language utf-8.. While i was exploring in the mysql i saw that the whole language were corrupted.. In the site it was looking good, but in the mysql were TOTALLY corrupted and that a problem..

After all i found a solution..

### open includesfunctionsdatabase.php ####
And find this :

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);

return $$link;
}


#### And replace with this ####

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);
mysql_query("SET CHARACTER SET utf8");
mysql_query("SET NAMES utf8");

} else {
$$link = mysql_connect($server, $username, $password);
mysql_query("SET CHARACTER SET utf8");
mysql_query("SET NAMES utf8");

}

if ($$link) {
mysql_select_db($database);
tep_db_query('SET time_zone='' . CONFIG_TIME_ZONE . ''');
}

return $$link;
}



Do the same for the adminincludesfunctionsdatabase.php

I hope this helps some people who may have the same problems as me..

Onoufriadis Christoforos
http://www.turbosim.gr
17 July 2008

Legend:  Download   Report

Expand All / Collapse All

How to adjust osCommerce to use UTF-8 8 May 2010  

Ignore previous uploaded instructions unless you are using a 8859-7 encoding. (windows)
If you want to adjust osCommerce to use UTF-8 -and you should- please use these new instructions i found, that also solve a major problem with $subject at email.php This applies to other languages too.

Crucial change in order for this to work 19 Mar 2010  
SET NAMES should suffice 7 Jul 2009  
Corrupted character on mysql with utf-8 16 Jul 2008