Zen Follower
- Join Date:
- Jun 2008
- Location:
- Japan
- Posts:
- 399
- Plugin Contributions:
- 6
UTF-8 Zen-Cart Tutorial for v1.3.x
I forgot this one is important too, check it please:
define('CHARSET', 'utf-8');
ZC v2.2.2 PHP 8.4+ MySQL 8.4+
Views: 77,326
Zen Follower
I forgot this one is important too, check it please:
define('CHARSET', 'utf-8');
ZC v2.2.2 PHP 8.4+ MySQL 8.4+
New Zenner
Hi,
Thank you all for your response.
I did things suggested but it doesn't work.
@lazy_666
I changed query_factory.php as I posted previously, is there any other code should be changed?
@CrystalKoi
I installed a fresh Zencart but the problem is still there.
My collation settings is utf8_general_ci. I changed collation to "utf8_general_ci" from phpMyAdmin->Operations befrore I install a fresh Zencart.
@pilou2
I transferred my cart from UNIX system to another UNIX so it should be OK. And "define('CHARSET', 'utf-8');" is OK, too.
As I mentioned, if I insert data from phpMyAdmin, it can be dispalyed correctly both on phpMyAdmin and Zencart, but if I input data from Zencart, it cannot be displayed correctly.
It seems that phpMyAdmin(or MySQL!?) can pass the correct character code to Zencart, but Zencart cannot pass correct character code to phpMyAdmin(or MySQL!?).
phpMyAdmin(send) -> (receive)Zencart (O)
Zencart(send) -> (receive)phpMyAdmin (X)
so the problem happens only when Zentcart tries to insert data into MySQL. Is that possible problem of my new server's setting? Thanks again.
Zen Follower
I have a problem with french language.
In phpMyAdmin, the collation is : utf8_unicode_ci
Jeu de caractères pour MySQL: UTF-8 Unicode (utf8)
In includes/languages/french.php :
@setlocale(LC_TIME, 'fr', 'french', 'fra', 'fr_FR', 'fr_FR@euro');
define('HTML_PARAMS','dir="ltr" lang="fr"');
define('CHARSET', 'utf-8');
In admin/includes/languages/french.php :
@setlocale(LC_TIME, 'fr', 'french', 'fra', 'fr_FR', 'fr_FR@euro');
define('HTML_PARAMS','dir="ltr" lang="fr"');
define('CHARSET', 'utf-8');
In page source of index.php :
Character Encoding-> UTF-8
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
In page source of admin/index.php :
Character Encoding-> iso-8859-1
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
Does any one know what could be the reason of this issue?
New Zenner
Hello,
Try this:
Go to your Zencart admin page,
Tools -> Developer Tool Kit
and search "iso-8859-1" from "look-up in all files" and check did you change all "iso-8859-1" to "UTF-8".
Good luck.
Mikado:
I have a problem with french language.
In phpMyAdmin, the collation is : utf8_unicode_ci
Jeu de caractères pour MySQL: UTF-8 Unicode (utf8)In includes/languages/french.php :
@setlocale(LC_TIME, 'fr', 'french', 'fra', 'fr_FR', 'fr_FR@euro');
define('HTML_PARAMS','dir="ltr" lang="fr"');
define('CHARSET', 'utf-8');
>
> In admin/includes/languages/french.php :
> ```
@setlocale(LC_TIME, 'fr', 'french', 'fra', 'fr_FR', 'fr_FR@euro');
define('HTML_PARAMS','dir="ltr" lang="fr"');
define('CHARSET', 'utf-8');
In page source of index.php :
Character Encoding-> UTF-8
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">In page source of admin/index.php :
Character Encoding-> iso-8859-1
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">Does any one know what could be the reason of this issue?
Zen Follower
I just did an install of this. I had to update one thing on the instructions. Changed the location of the language file for the Admin. I'm sure most people got that anyways.
I fallowed my instructions to see if I would get any problems, and all is fine.
Sorry and Good luck,
CKD
New Zenner
Hi
I resolved my problem by changing my server provider. So my issue was nothing to do with Zencart or MySQL. Sorry to confuse you all and thanks for your advices.
New Zenner
I think I have a couple of issues related to language encoding.. this seems the proper thread to ask.
I have English Zen Cart installed and then added the Simplified Chinese language pack, GB2312. Adding/viewing Chinese thru web browser is fine (product desc, categories etc)
But found a couple of issues :
Other parts of the email shows chinese just fine.
Bcos the database is in ISO-8859??
Is there anyway to rectify without reinstalling. Just by changing the encoding of the database?
Thanks.
New Zenner
Hello! I need help please. I use ZC in two languages English and Russian. I've defined the charsets in both english.php and russian.php as UTF-8. I have converted all Rusian PHP files from ANSI to UTF-8 without BOM. I have then changed all database tables colladion to utf_general_ci. I have no problems with characters displaing but when I perform search in search engine in Russian it comes with no result. The search browser doesn't see anuthing in Russian. Can anybody help me please? Where is the problem?
New Zenner
Hi, I have a problem with the search in my zen-car when I use UTF-8 encoding
My database is in collation utf8, charset in bulgarian.php and in english.php is utf-8 too.My DB/tables are utf8 but I can make search when type cyrillic words. It shows no results. With English word everything is OK:)
Can somebody help me?!
New Zenner
See forums.oscommerce.com/index.php?showtopic=262287 for a possible solution?
Totally Zenned
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.)
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.
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
Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...
Sensei
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.
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
Totally Zenned
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
Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...
New Zenner
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:
'מרכזיות'
The MySql is set to ```
COLLATE utf8_general_ci
Site is <https://www.addvant.co.il>
Thanks
AddVant
**VoIP **and get more when you communicate https://www.addvant.com
Zen Follower
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):
// 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;
}
}
Totally Zenned
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?
Zen Follower
Before you install Zen-Cart you need to change the database Collation. That should take care of the database.
Totally Zenned
I've already zencart 1.3.7 installed, and the collation into db is already set to utf-8
New Zenner
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.
Should I install a fresh copy of Zen Cart 1.3.8a and after that install the UTF-8 add-on?
Should I follow the instructions of this thread and Configure the database first and follow the steps as recommended in https://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:
Zen Follower
They should both work, I kind of like the one on srw2d.com :wink::cool:
Tell staff why this post should be reviewed.