Products     Magento Extension     PCI-Shopping-Carts     Templates       CRELoaded     WordPress Modules     osCommerce Modules       osCommerce Addons       osCommerce Features       osCommerce Management       Payment Modules     CRELoaded Modules       CRE Loaded Addons       CRE Loaded Features       CRE Loaded Management       Payment Modules       CRELoaded Services
Free Stuff
Customization
Templates
Compare Products
You have no items to compare.
Affiliate Info
Affiliate Program FAQ
Affiliate Log In
Recent Orders
Hot Keywords: Order Notification, Order Search, Coupon, Flash Board, Compare, Floating Message, Tracking, Moneris, RSS, Visitor Filter

  Corrupted character on mysql with utf-8

The following osCommerce contribution is a free Opensource code originated from official osCommerce website and provided for your reference only, you may download the original contribution file(s) and install it on your own; or you may request a Paid Installation Service from Agents Of Power; Agents Of Power does the "AS IS" installation on your website, we do not guarantee it will work properly on your website. Extra Paid service is available for repairing the problem from the original contribution or from your website.
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/en/charset-connection.html http://forum.alsacreations.com/topic-17-40579-1-resolu-Chinois-et-base-de-donnees.html
http://wiki.pooteeweet.org/MDB2/CharacterSet
   Posted on: 07/07/2009     See contribution details Request Installation with Paid service