Tuesday, March 10, 2009

Chinese Character Problems in Zen Cart

I needed to put some links with Chinese, Thai and Japanese characters in a header on a Zen Cart home page. I had a hard time finding the place in the templates and php files where I needed to specify the utf-8 character encoding.

Eventually I stumbled on the /includes/languages/your-template/english.php file which is where the magic happens.

// charset for web pages and emails
define('CHARSET', 'utf-8');

is the way you need to make it. If you don't, then your character set will be wrong, since Zen Cart installs with iso-8859-1 by default, and you'll get nonsense characters instead of Chinese.

I don't know why I couldn't find this file...it's the obvious place to look. I guess I had the wrong english.php file open...

I also ran into a great forum post on the Zen Cart forums. A user named Incouto provides a good explanation of character sets, collation in mysql and in the php query controller.

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home