Zen Cart Logo
Forums / Addon Language Packs / Special characters not displaying correctly in UTF-8

Special characters not displaying correctly in UTF-8

Locked

Views: 12,371

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
14 Jul 2008, 2:40 PM
#1
lagrange avatar

lagrange

New Zenner

Join Date:
Jul 2008
Posts:
9
Plugin Contributions:
0

Special characters not displaying correctly in UTF-8

Hi,

I had a problem with the names of categories, ezpages content, featured products content, manufacturers, not displaying correctly in UTF-8 in frontend. Having it solved successfully, I meant that the solution might interest somebody else, since I haven't found anything useful on the forum about it.

The problem was that the database tables, from which ZC reads data for categories, ezpage, featured products etc., were initially (i.e. at the moment of installation) encoded in a wrong character set. They were encoded in latin1_swedish_ci, instead of utf8_general_ci. In MySQL, it is called collation. So, basically, the problem was due to a database issue. I managed to correct it by converting the original collation to utf-8 in the following mode:

  1. BACKUP YOUR ENTIRE DATABASE!!!!!
  2. open phpMyAdmin in your cPanel
  3. choose your ZC database and take a look at which tables (if not all) are in not utf-8 collation (encoding)
  4. click SQL tab at the top of your phpMyAdmin screen and type the following text into the "Run SQL query/queries on database xxxxxx" field:
ALTER TABLE [I]name of the table[/I] DEFAULT CHARACTER SET utf8

Run the query and that's it. You have changed the default collation for the chosen table. Check on your frontend, if special characters e.g. for your categories now display correctly in utf-8 encoding.

14 Jul 2008, 5:48 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Special characters not displaying correctly in UTF-8

Or use escape characters for specials

14 Jul 2008, 7:18 PM
#3
lagrange avatar

lagrange

New Zenner

Join Date:
Jul 2008
Posts:
9
Plugin Contributions:
0

Re: Special characters not displaying correctly in UTF-8

I would suggest that the next version of ZC installation instructions should contain a recommendation to international users, that it is advisable to create the ZC database in a collation, supporting their national charset or directly in utf-8 (provided the inclusion of an utf-8 support in the next version of ZC). In that case, many difficulties will be avoided.

15 Jul 2008, 3:38 AM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Special characters not displaying correctly in UTF-8

latin1_swedish_ci is fairly universal

collation and char set are different animals

15 Jul 2008, 7:35 AM
#5
lagrange avatar

lagrange

New Zenner

Join Date:
Jul 2008
Posts:
9
Plugin Contributions:
0

Re: Special characters not displaying correctly in UTF-8

Well, the swedish collation didn't work for me. Utf-8 did. For the rest, you can be utterly right, since I am a beginner in these things.

15 Jul 2008, 7:52 AM
#6
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Special characters not displaying correctly in UTF-8

You might check for the future setting your lang char set in english.php

  @setlocale(LC_ALL, 'en_US.ISO_8859-1');
  define('DATE_FORMAT_SHORT', '%m/%d/%Y');  // this is used for strftime()
  define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime()
  define('DATE_FORMAT', 'm/d/Y'); // this is used for date()
  define('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S');
17 Jul 2008, 8:04 AM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Special characters not displaying correctly in UTF-8

kobra:

collation and char set are different animals

This is very true.

17 Jul 2008, 7:32 PM
#8
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Special characters not displaying correctly in UTF-8

DrByte:

This is very true.
And if interested in reading - one can google for it and it is very confusing and not sure that anyone "fully" has a handle on it

16 Nov 2009, 6:42 PM
#9
pisceandelusions avatar

pisceandelusions

New Zenner

Join Date:
Jul 2009
Location:
NorthEastern United States
Posts:
4
Plugin Contributions:
0

Re: Special characters not displaying correctly in UTF-8

Note: This was originally posted in another thread but I wanted to come back into here to help anyone else who was still stryggling with the issue.

http://www.zen-cart.com/forum/showthread.php?t=36382