Zen Cart Logo
Forums / General Questions / special character problem - otion values

special character problem - otion values

Locked

Views: 1,526

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
19 Dec 2008, 5:33 PM
#1
billharris avatar

billharris

New Zenner

Join Date:
Aug 2008
Location:
California
Posts:
8
Plugin Contributions:
0

special character problem - otion values

I am having a problem with the display of special characters (non-ASCII) in my Zencart pages, but only in the names of product option values.

The special characters are entered in the database as numeric character references.

The special characters display correctly in the products page. However, in the shopping cart contents and the confirmation page, the names of product options values do not display correctly. Note, however, that the names of product options do display correctly with the same characters.

Example: the word ĝis is displayed incorrectly as & #285;is.

OS: Windows XP
Zencart 1.3.8
Language: English
english.php contains the line define('CHARSET', 'utf-8');
database charset is utf-8
database connection collation is utf-unicode-ci
the collation value for product options and product options values is utf-unicode-ci

I would appreciate any help with this problem.
I apologize in advance if this post is in the wrong place.

Thank you.

19 Dec 2008, 7:24 PM
#2
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,847
Plugin Contributions:
3

Re: special character problem - otion values

Hi,

I have a reasonably good idea of why this is happening,

Could you post the version of Zen Cart you are using, and the version of PHP your server uses.

Ian

19 Dec 2008, 7:41 PM
#3
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,847
Plugin Contributions:
3

Re: special character problem - otion values

k, the reason why the output is broken is due to the zen_output_string_protected function.

We use this on cart/confirmation for value names, as some of these may have been provided by the user, if you use the TEXT option type,

zen_output_string_protected uses htmlspecialchars on the output string. This will convert all & signs in the output string to &

so &258; becomes &amp258;, hence why it displays as such.

Can I ask why you use the entity value and don't just enter the character in admin as ĝ

20 Dec 2008, 2:32 AM
#4
billharris avatar

billharris

New Zenner

Join Date:
Aug 2008
Location:
California
Posts:
8
Plugin Contributions:
0

Re: special character problem - otion values

wilt:

k, the reason why the output is broken is due to the zen_output_string_protected function.

We use this on cart/confirmation for value names, as some of these may have been provided by the user, if you use the TEXT option type,

zen_output_string_protected uses htmlspecialchars on the output string. This will convert all & signs in the output string to &

so &258; becomes &amp258;, hence why it displays as such.

Can I ask why you use the entity value and don't just enter the character in admin as ĝ

I'm sorry, my example was not quite correct.
I use a software program that enters the ĝ as an ampersand followed by a pound sign followed by the three digits 285 followed by a semicolon. I think that is standard NCR notation.

I can see that the htmlspecialchars function would give the results that I am getting.
However, I have an option that asks for text input. If the user enters a special character such as the ĝ, it is displayed correctly in the shopping cart and confirmation page. Only the option values names seem to be affected.

I don't know of any way to enter these special characters without using an ampersand. How can I best solve my problem?

Thanks,

22 Dec 2008, 2:27 AM
#5
billharris avatar

billharris

New Zenner

Join Date:
Aug 2008
Location:
California
Posts:
8
Plugin Contributions:
0

Re: special character problem - otion values

I managed to solve my problem by modifying the PHP code to apply the zen_output_string_protected function to text option_values only
in the shopping cart, the confirmation, and the order history.

Thank you for your help.