First of all, the Zen-Cart encoding is IS0-8859-1 by default. IS0-8859-1 can be changed to UTF-8 with not much effort!
The first change needed is to english.php:
The path to this file is: includes/languages/english.php
1->Line 22 or near there if the file has been edited, you will find this:
@setlocale(LC_TIME, 'en_US.ISO_8859-1');
2->Change this line to this:
@setlocale(LC_TIME, 'en_US.utf8');
3->Line 49 or so again. Find this:
define('CHARSET', 'iso-8859-1');
4->Change it to this:
define('CHARSET', 'utf-8');
The next file to change has the same name but is in a different directory:
Find it in: admin/includes/languages/english.php
1->On line 20 find:
setlocale(LC_TIME, 'en_US.ISO_8859-1');
2->Change to this:
setlocale(LC_TIME, 'en_US.utf8');
3->On line 63 find:
define('CHARSET', 'iso-8859-1');
4->Change this to:
define('CHARSET', 'utf-8');
The next change is to query_factory.php.
Find it in: includes/classes/db/mysql/query_factory.php
1-> Find this (line 33):
// pconnect disabled ... leaving it as "connect" here instead of "pconnect"
$this->link = @mysql_connect($zf_host, $zf_user, $zf_password, true);
}
if ($this->link) {
if (@mysql_select_db($zf_database, $this->link)) {
$this->db_connected = true;
return true;
} else {
$this->set_error(mysql_errno(),mysql_error(), $zp_real);
return false;
}
} else {
$this->set_error(mysql_errno(),mysql_error(), $zp_real);
return false;
}
}
2-> Change to this (this will not work as an override):
// pconnect disabled ... leaving it as "connect" here instead of "pconnect"
$this->link = @mysql_connect($zf_host, $zf_user, $zf_password, true);
}
if ($this->link) {
if (@mysql_select_db($zf_database, $this->link)) {
//BOF changed for utf-8
mysql_query('SET NAMES "utf8"', $this->link);
//EOF changed for utf-8
$this->db_connected = true;
return true;
} else {
$this->set_error(mysql_errno(),mysql_error(), $zp_real);
return false;
}
} else {
$this->set_error(mysql_errno(),mysql_error(), $zp_real);
return false;
}
}
Note the key change is :
//BOF changed for utf-8
mysql_query('SET NAMES "utf8"', $this->link);
//EOF changed for utf-8
Also, here is an important tip. At this point you should change your admin folder name now for security issues. For more information on this go [here]
No comments:
Post a Comment