Forums / General Questions / Help Please!!! Database Encoding

Help Please!!! Database Encoding

Locked

Started by ijlal on 11 Feb 2010, 1:42 PM · Views: 3,907

Results 1 to 12 of 12
This thread is locked. New replies are disabled.
11 Feb 2010, 1:42 PM
#1
ijlal avatar

ijlal

New Zenner

Join Date:
Jan 2010
Posts:
45
Plugin Contributions:
0

Help Please!!! Database Encoding

Orig Install: Zen-Cart Version 1.3.8; patched; Admin folder renamed
Addons: Stock by Attributes Mod version 1.4.9
Customization: Custom design (slight modification to Blue Highlites theme); All modifications to Zen-Cart done using Custom Overrides as explained in tutorials

Whenever I entered a particular product or edited it, and gave the following description:

**Senator **
Tried and true, the Penn Senator has been an icon on the big game fishing scene, even before the original release of that famous shark movie, Jaws®. The Penn Senatorremains the most trusted, most powerful star drag reel on the market. In fact, most of the original Senator® reels are still fishing, even after decades of service. Little wonder that Penn Senators® have caught more IGFA big game world records than all other makes combined; and with five sizes available, there is a Senator® for everything from movie sized sharks, to grouper, cod, and rockfish.

I always got only:

**Senator **

Tried and true, the Penn Senator has been an icon on the big game fishing scene, even before the original release of that famous shark movie, Jaws

No matter what I tried, the result was the same. Suddenly it dawned upon me after many days that the database was was not accepting special characters! I removed all '®' from the text and got it to display my product description completely!

Now my question is: How do I change database encoding to make it accept all characters without reinstalling Zen-Cart? I am using MySQL version 5.0.87-community and can access this from cPanel provided by my Linux-based host. Please help as I am quite raw to using databases.

Thanks,
Ijlal

11 Feb 2010, 2:09 PM
#2
kobra avatar

kobra

Black Belt

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

Re: Help Please!!! Database Encoding

Now my question is: How do I change database encoding to make it accept all characters without reinstalling Zen-Cart?
Do not use special characters

Use their html or ansi equivalents

spaces are mne to prevent parsing

® = & # 174 ;

There are many sources for these and this is only one

http://www.theukwebdesigncompany.com/articles/entity-escape-characters.php

Zen-Venom Get Bitten

11 Feb 2010, 2:26 PM
#3
ijlal avatar

ijlal

New Zenner

Join Date:
Jan 2010
Posts:
45
Plugin Contributions:
0

Re: Help Please!!! Database Encoding

kobra:

Do not use special characters

Use their html or ansi equivalents

spaces are mne to prevent parsing

® = & # 174 ;

There are many sources for these and this is only one

http://www.theukwebdesigncompany.com/articles/entity-escape-characters.php

I tried as you advise, but HTMLarea changes the code to the special character and saves it as ®. Even when you toggle to HTML source, it still shows ® and does not display &#174. After I save, I am getting the same problem as before. The text gets cut off from the first instance of ®

Thanks.

11 Feb 2010, 2:32 PM
#4
llynix avatar

llynix

Zen Follower

Join Date:
Jul 2009
Location:
Texas
Posts:
210
Plugin Contributions:
0

Re: Help Please!!! Database Encoding

You should be able to use ®

DentalPlanet Designed/Administrated by Falls Geek

11 Feb 2010, 2:32 PM
#5
vger avatar

vger

Past Contributor

Join Date:
Nov 2004
Location:
Norfolk, United Kingdom
Posts:
3,189
Plugin Contributions:
0

Re: Help Please!!! Database Encoding

You can easily get around this. Instead of inputting the symbol for registered at every mention of a registered name include text like this at the bottom of the description:

"The names Jaws, Senator and Senators are the registered trade marks of their repective owners."

Vger

11 Feb 2010, 2:35 PM
#6
ijlal avatar

ijlal

New Zenner

Join Date:
Jan 2010
Posts:
45
Plugin Contributions:
0

Re: Help Please!!! Database Encoding

Okay I achieved the desired result by changing the editor to text and then replacing the special character with HTML code, but is there a way to change the default encoding of the database? Maybe I did not choose the correct encoding at the time of installation?

Thanks once again for your help!

11 Feb 2010, 3:22 PM
#7
ijlal avatar

ijlal

New Zenner

Join Date:
Jan 2010
Posts:
45
Plugin Contributions:
0

Re: Help Please!!! Database Encoding

Ladies and Gents,

In the present scenario, this isn't a very practical way of solving the problem on hand. Everytime, I make an edit I have to go make changes in the source code, otherwise I end up losing data, even in text editor.

Is there no way to change default encoding of database?

Thanks.

11 Feb 2010, 3:40 PM
#8
vger avatar

vger

Past Contributor

Join Date:
Nov 2004
Location:
Norfolk, United Kingdom
Posts:
3,189
Plugin Contributions:
0

Re: Help Please!!! Database Encoding

Okay, if that's the route you want to go down then this is what you have to do:

  1. Download a backup of your database using phpMyAdmin.
  2. Edit all tables to remove references to MyIsam.
  3. Change the page encoding in Zen Cart to utf8 in includes/languages/english.php - specifically change
    define('CHARSET', 'iso-8859-1');
    to
    define('CHARSET', 'utf8');
  4. Open every single page file in Zen Cart (over 1,000) in a Plain Text Editor set for utf8 encoding, and click Save.
  5. Check all those files to make sure there are no odd characters in any of the files now that you have changed the encoding (especially at the start and end of the file).
  6. Drop the contents of the MyIsam database which used iso-8859-1 (Latin 1) encoding and upload the modified database in utf8.
  7. Upload all modified files.
  8. Pray it all works fine.

If you work 16 hour days then you should probably be finished within one week.

I personally think this is taking a sledgehammer to crack a nut and that modifying the product descriptions would be a whole lot easier.

Vger

11 Feb 2010, 4:56 PM
#9
ijlal avatar

ijlal

New Zenner

Join Date:
Jan 2010
Posts:
45
Plugin Contributions:
0

Re: Help Please!!! Database Encoding

Vger:

Okay, if that's the route you want to go down then this is what you have to do:

  1. Download a backup of your database using phpMyAdmin.
  2. Edit all tables to remove references to MyIsam.
  3. Change the page encoding in Zen Cart to utf8 in includes/languages/english.php - specifically change
    define('CHARSET', 'iso-8859-1');
    to
    define('CHARSET', 'utf8');
  4. Open every single page file in Zen Cart (over 1,000) in a Plain Text Editor set for utf8 encoding, and click Save.
  5. Check all those files to make sure there are no odd characters in any of the files now that you have changed the encoding (especially at the start and end of the file).
  6. Drop the contents of the MyIsam database which used iso-8859-1 (Latin 1) encoding and upload the modified database in utf8.
  7. Upload all modified files.
  8. Pray it all works fine.

If you work 16 hour days then you should probably be finished within one week.

I personally think this is taking a sledgehammer to crack a nut and that modifying the product descriptions would be a whole lot easier.

Vger

Hey Vger,

That is really a tough route to take! :frusty:

I did a little more research and made a few modifications as suggested at http://www.srw2d.com/content/english-is0-8859-1-files-utf-8 and guess what? My problem is solved! :clap:

Thanks anyhow for yours and others' suggestions - No offence meant.

Have a great day!
Ijlal

11 Feb 2010, 5:01 PM
#10
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Help Please!!! Database Encoding

I could be wrong here, but part of the problem may lie within the HTMLArea editor, which is known to "have a mind of its own" when certain html characters and tags are used.

FCKEditor may be a better bet, as is TinyMCE

(I do most of my edits in plain text mode - even if the page is html - so I don't encounter these issues much.)

20 years a Zencart User

11 Feb 2010, 5:37 PM
#11
vger avatar

vger

Past Contributor

Join Date:
Nov 2004
Location:
Norfolk, United Kingdom
Posts:
3,189
Plugin Contributions:
0

Re: Help Please!!! Database Encoding

Erm?? Good luck if that solved it - but you did miss out the previous and following pages on the link you provided, because that advice only covered changes you need to make BEFORE installing Zen Cart.

You are dealing with an already installed website - quite a different thing.

Vger

11 Feb 2010, 5:39 PM
#12
ijlal avatar

ijlal

New Zenner

Join Date:
Jan 2010
Posts:
45
Plugin Contributions:
0

Re: Help Please!!! Database Encoding

schoolboy:

I could be wrong here, but part of the problem may lie within the HTMLArea editor, which is known to "have a mind of its own" when certain html characters and tags are used.

FCKEditor may be a better bet, as is TinyMCE

(I do most of my edits in plain text mode - even if the page is html - so I don't encounter these issues much.)

I do not like HTMLarea too, but even the text editor was displaying the special character the next time I opened the product to edit. If I then saved again the problem reappeared, so I guess it was more of an character encoding problem.

Thanks,
Ijlal