Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Support for HTML special chars


Irin

Recommended Posts

Posted

Hello,

 

What should I change in order to have HTML special chars show correctly for company and customer's first and last names in admin/orders.php, invoice.php, packingslip.php and also in order confirmation email sent to the customer? In database I have all the special chars shown correctly but in admin/orders.php, invoice.php, packingslip.php and also in order confirmation email sent to the customer they are shown as garbage, & # 324;

 

Ex. of customer from Poland: Zistof Takiński

 

Any help would be appreciated.

 

Thanks.

Posted
& # 324;

 

Not garbage - it's the ansi/ascii code for that character.

 

The standard osCommerce character set is iso-8859-1 (also known as Latin 1), which only supports standard European characters but doesn't support languages such as Swedish, Eastern European and Cyrillic alphabets.

 

To make things display correctly you are going to have to make osCommerce work with utf8 character encoding. This is not easy but it can be done.

 

The MySQL and phpMyAdmin characters set you use is probably utf8 already. You'd need to check in php.ini, provided you have access to it, that the php default character set is utf8, and then you start the other work.

 

Change the character set encoding in includes/languages/english.php, spanish.php - whichever languages you are using.

 

Open all files in an editor like PS Pad, and make sure that PS Pad is set to open files in utf8, and then Save all files again. That's a start.

 

Vger

Posted

Hi Vger,

 

In my php.ini I have default_charset option commented out and using iso-8859-1 charset:

;default_charset = "iso-8859-1"

Should I just change it to look like this:

default_charset = "UTF-8"

In my includes/languages/english.php I have the following:

@setlocale(LC_TIME, 'en_US.ISO_8859-1');

Should I just change it to look like this:

@setlocale(LC_TIME, 'UTF-8');

Is there anything else I'd need to change to support the utf8 character encoding?

 

Thanks.

Posted

includes/languages/english.php etc:

// charset for web pages and emails
define('CHARSET', 'iso-8859-1');

 

You need to do this changeover on a copy of your website in a folder, to prevent disrupting the main website and define the character set via a local php.ini file in the folder of your test site. You may even want to do it on a different hosting account.

 

As for the rest I've already given a pointer - all files need to be opened and resaved in utf8 format - and this may itself cause problems with invalid characters becoming corrupted (hence the need not to do this on a live site).

 

Vger

Posted

From your reply I can understand that it is not recommended to change the default character set to UTF-8. If this is the case, is there anything else that I might try to have a support for Swedish, Eastern European and Cyrillic alphabets in my live site? Am I the only one who needs that support? I don't have a test site to try the changes.

 

Thanks.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...