Forums / General Questions / Again with character encodings...

Again with character encodings...

Locked

Views: 1,400

Results 1 to 13 of 13
This thread is locked. New replies are disabled.
2 Dec 2008, 9:40 AM
#1
pasi avatar

pasi

Zen Follower

Join Date:
Mar 2004
Location:
Finland
Posts:
435
Plugin Contributions:
1

Again with character encodings...

Hi,

A slight problem with encodings again...

Language files and database are ISO-8859-15 which work perfectly on my devbox and with all the shops I've installed in the past.

Now this one shop I'm doing now sends the catalog as UTF-8, meaning all the äöåÄÖÅ characters are messed up!

If I change the encoding by hand in firefox to ISO-8859-15 the page shows correctly....

Admin side sends pages as ISO-8859-15 and shows all characters correctly.

I've debugged the catalog side with firefox addon "Live HTTP headers" and it shows a line like this:
Content-Type: text/html; charset=UTF-8

Now the question is, how do I change the Content-Type ??

The encoding settings in language files are set up correctly and the shop has a "<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />
" header in the html.

Also I've tried to set up the encoding in .htaccess file in the root with all sorts of different setting I've managed to find in the web so far.

Any help would be greatly appriciated!

Working with Zen Cart since 2003 :: www.prr.fi
Author of the original Finnish language pack for Zen Cart since 2004

2 Dec 2008, 10:22 AM
#2
drbyte avatar

drbyte

Sensei

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

Re: Again with character encodings...

How many "init_templates.php" files do you have on your site? Which folders are they in? How are those files different from the original Zen Cart files?
What version of Zen Cart are you working with?

.
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.

2 Dec 2008, 10:25 AM
#3
pasi avatar

pasi

Zen Follower

Join Date:
Mar 2004
Location:
Finland
Posts:
435
Plugin Contributions:
1

Re: Again with character encodings...

There's actually another 1.3.7 version of zencart installed (customers own try of installing zencart previously) which shows the catalog correctly as ISO-8859-15 with the same language files!

Working with Zen Cart since 2003 :: www.prr.fi
Author of the original Finnish language pack for Zen Cart since 2004

2 Dec 2008, 10:28 AM
#4
pasi avatar

pasi

Zen Follower

Join Date:
Mar 2004
Location:
Finland
Posts:
435
Plugin Contributions:
1

Re: Again with character encodings...

DrByte:

How many "init_templates.php" files do you have on your site? Which folders are they in? How are those files different from the original Zen Cart files?
What version of Zen Cart are you working with?

I'm working (like always) with the latest version of Zen Cart.

Is this what you mean?:

find |grep init_templates.php
./includes/init_includes/init_templates.php
./admin/includes/init_includes/init_templates.php

Only edits I have made are made in the template files.

Working with Zen Cart since 2003 :: www.prr.fi
Author of the original Finnish language pack for Zen Cart since 2004

2 Dec 2008, 10:34 AM
#5
drbyte avatar

drbyte

Sensei

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

Re: Again with character encodings...

The Content-Type charset is set in the init_templates.php file, using the constant for CHARSET defined in your language files.

.
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.

2 Dec 2008, 10:35 AM
#6
pasi avatar

pasi

Zen Follower

Join Date:
Mar 2004
Location:
Finland
Posts:
435
Plugin Contributions:
1

Re: Again with character encodings...

if I copy the source html code of the main page and save it to a file test.html (or .php), the content is output correctly

Working with Zen Cart since 2003 :: www.prr.fi
Author of the original Finnish language pack for Zen Cart since 2004

2 Dec 2008, 10:39 AM
#7
pasi avatar

pasi

Zen Follower

Join Date:
Mar 2004
Location:
Finland
Posts:
435
Plugin Contributions:
1

Re: Again with character encodings...

DrByte:

The Content-Type charset is set in the init_templates.php file, using the constant for CHARSET defined in your language files.

Editing this file, by hardcoding a different encoding doesn't make any difference.

No matter what I set it to the server sends this header:

Content-Type: text/html; charset=UTF-8

Working with Zen Cart since 2003 :: www.prr.fi
Author of the original Finnish language pack for Zen Cart since 2004

2 Dec 2008, 10:52 AM
#8
pasi avatar

pasi

Zen Follower

Join Date:
Mar 2004
Location:
Finland
Posts:
435
Plugin Contributions:
1

Re: Again with character encodings...

Getting weirder by the moment....

the popup window:
/index.php?main_page=popup_shipping_estimator

is showing with ISO-8859-15 with all ä's and ö's as they should be!

Working with Zen Cart since 2003 :: www.prr.fi
Author of the original Finnish language pack for Zen Cart since 2004

2 Dec 2008, 11:24 AM
#9
pasi avatar

pasi

Zen Follower

Join Date:
Mar 2004
Location:
Finland
Posts:
435
Plugin Contributions:
1

Re: Again with character encodings...

also login page shows correctly and few other pages.

It's like the server is guessing the encoding per page and ignoring anything set by zencart!

Working with Zen Cart since 2003 :: www.prr.fi
Author of the original Finnish language pack for Zen Cart since 2004

2 Dec 2008, 11:27 AM
#10
drbyte avatar

drbyte

Sensei

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

Re: Again with character encodings...

pasi:

There's actually another 1.3.7 version of zencart installed (customers own try of installing zencart previously) which shows the catalog correctly as ISO-8859-15 with the same language files!

How does that installation differ from what you're working with? Including file encoding methods on each file?

.
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.

2 Dec 2008, 11:47 AM
#11
pasi avatar

pasi

Zen Follower

Join Date:
Mar 2004
Location:
Finland
Posts:
435
Plugin Contributions:
1

Re: Again with character encodings...

DrByte:

How does that installation differ from what you're working with? Including file encoding methods on each file?

AFAIK. it's 100% unchanged installation directly from the zip package, apart from the Finnish language pack (which is the exact same package as is installed in the bugging shop)

is there really no way to FORCE the output to some encoding.... something that would overwrite all other encodings set by anything!?

There seems to be no logic to what pages are shown as utf-8 and what pages are iso-8859-15

I even checked if it was the data from the database that messes it up, but this was not the case (remember: admin side works correctly)!

Working with Zen Cart since 2003 :: www.prr.fi
Author of the original Finnish language pack for Zen Cart since 2004

2 Dec 2008, 8:53 PM
#12
drbyte avatar

drbyte

Sensei

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

Re: Again with character encodings...

pasi:

is there really no way to FORCE the output to some encoding.... something that would overwrite all other encodings set by anything!?
The code in the /includes/init_includes/init_templates.php file does exactly that.

.
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.

3 Dec 2008, 9:55 AM
#13
pasi avatar

pasi

Zen Follower

Join Date:
Mar 2004
Location:
Finland
Posts:
435
Plugin Contributions:
1

Re: Again with character encodings...

DrByte:

The code in the /includes/init_includes/init_templates.php file does exactly that.

Thanks for your help :)

I copied the header part to template file html_header.php as the first line, and it did the trick :)

Dunno what caused it but it's now solved!

Working with Zen Cart since 2003 :: www.prr.fi
Author of the original Finnish language pack for Zen Cart since 2004