View Single Post
  #1  
Old 03-19-2007, 04:15 AM
 
m0bius m0bius is offline
 

Newbie
  
Join Date: Oct 2006
Posts: 5
 

Default UTF-8 Database and X-Cart

Hello there,

I just wanted to share with everyone my minor X-Cart modification. I have a website which is entirely a UTF-8 site. In order for X-Cart to be fully compatible I changed the .sql files coming with X-Cart modifying the database tables to use UTF-8 collation and the template pages UTF-8 character encoding.

In order to properly store UTF-8 data in the database, however mysql NAMES must be set to utf8. This must be the first query executed after a mysql connect.

Therefore I modified include/func/func.db.php function db_connect (line 42):
Quote:
return mysql_connect($sql_host, $sql_user, $sql_password);

to

Quote:
$ret = mysql_connect($sql_host, $sql_user, $sql_password);
@mysql_query('SET NAMES utf8');
return $ret;

Hope that helped anyone.
__________________
X-Cart 4.1.9
Reply With Quote