Re: UTF-8 Zen-Cart Tutorial
Hi,
Some notes about my experience with this.
I am rebuilding a site that developed a (non-encoding-related) problem I could not solve so I started again and since I have an english-spanish site it seemed a good idea to go UTF-8 from this new start.
I followed the tutorial and all seemed to work ok.
Now I am gradually adding in the template mods I did previously.
(I’m using Notepad++ which shows the encoding of the file and can convert between different encodings and UTF-8, it reports the file encoding on the bottom right of the status bar.)
1) Adding spanish language files (from an old contribution which I have updated to 1.38a).
Firstly I found that any accented character was wrongly reproduced in the shop.
Notepad++ reported the relevant language file as being ANSI encoded.
I converted this to UTF-8, the accented characters in the file changed to unrecognised characters which once corrected displayed correctly in the shop.
2) Next I started getting blank screens on certain places in the shop.
I found that this was due to now having the spanish.php (or english.php) encoded as “UTF-8” instead of “UTF-8 without BOM”.
Things seem ok now.
So, I don’t know whether I now have to convert every file in the shop whether pure php or only the language files to have things as they ”should be”?
Regards
Steve
Re: UTF-8 Zen-Cart Tutorial
Language files: all should be UTF-8 without BOM.
Template files and other PHP files: any file that contains special characters should also be converted to UTF-8 without BOM. However, if you've used language constants properly, you should never need to touch any other files.
SQL files: the files in the zc_install folder are only used during installation or upgrade. As such, if your site is already installed, there's no need to convert them.
Re: UTF-8 Zen-Cart Tutorial
Thanks for that confirmation,
I just found it strange that no-one else had mentioned similar symptoms regarding the encoding of language files.
In practice Notepad++ does not "convert" a file from ANSI to UTF-8 if there are no accented chars in the file (such as in a pure php file): on reopening the file it is reported as being still ANSI.
Anyway everything seems to be working UTF-fine now so full marks to CrystalKoi,
regards
Steve
Re: UTF-8 Zen-Cart Tutorial
Dear Friends,
Many thanks for this thread and the information converting the site to UTF-8.
I have done everything as written and it works fine on both the web site and Admin side. Language is Hebrew on GoDaddy shared hosting with MySql 5.
The issue we having is when we insert information from the website/admin we have everythig ok on the web/admin side but on the MySql PHP Admin we get unreadable characters.
If we key information in the MySql PHP Admin we get unreadable characters on the site/admin.
Here is sample of characters we get on the MySql PHP Admin:
Quote:
'מרכזיות'
The MySql is set to
Code:
COLLATE utf8_general_ci
Site is www.addvant.co.il
Thanks
AddVant
Re: UTF-8 Zen-Cart Tutorial
@AddVant
1st, you did the database Collation before you installed Zen-Cart?
Also, you did this too?:
The next change is to query_factory.php.
NOTE:
With v1.3.9 you don't have to touch the query_factory.php file.
You should use this method instead: http://www.zen-cart.com/forum/showthread.php?t=153582
For v1.3.8 and OLDER, use the following:
Find it in: includes/classes/db/mysql/query_factory.php
1-> Find this (line 33):
PHP Code:
// 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):
PHP Code:
// 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;
}
}
Re: UTF-8 Zen-Cart Tutorial
I would change all my zencart to UTF-8, for full compatibility with all browser. But I've to change into UTF-8 all my db tables?
Re: UTF-8 Zen-Cart Tutorial
Before you install Zen-Cart you need to change the database Collation. That should take care of the database.
Re: UTF-8 Zen-Cart Tutorial
I've already zencart 1.3.7 installed, and the collation into db is already set to utf-8
Re: UTF-8 Zen-Cart Tutorial
HI,'
There is an add-on for UTF-8 fro Zen Cart 1.3.8a
UTF-8 Support for ZenCart 1.3.8a
Author: Markos Kyriacou
I am in process of installing a fresh Zen Cart 1.3.8a. After reading through the posts in this thread, I am still a little confused.
1. Should I install a fresh copy of Zen Cart 1.3.8a and after that install the UTF-8 add-on?
2. Should I follow the instructions of this thread and Configure the database first and follow the steps as recommended in www.srw2d.com/content/utf-8-zen-cart? Do I still need to install the UTF-8 add-on?
Please advise for Zen Cart newbie!
Thank You!!!!
:smile:
Re: UTF-8 Zen-Cart Tutorial
They should both work, I kind of like the one on srw2d.com :wink::cool: