Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

diference between catalog product description and views on web site


alexman

Recommended Posts

1.In my admin catalog, french translation of products descriptions looks ok, but when I enter on web site it appears with strange characters.

For example:in admin/catalog/product description I have:IMMUNITÉ,   versus IMMUNITÉ on my web site

Why is this difference?

I use ver 2.3.3.Thx

 

2.Is it any addon that send me an sms when I have an order from a customer?

Thx

Link to comment
Share on other sites

Just to clarify, you're looking at the same text appearing on two different pages (one in admin, the other in public catalog)? What you're seeing with IMMUNITÉ is the text being displayed in UTF-8 encoding, while IMMUNITÉ is the same text being displayed in a single byte encoding, such as Latin-1. Accented letters in UTF-8 are two or more bytes, which show up as a single character on a UTF-8 page, but as multiple characters in Latin-1. For some reason, your catalog page is displaying in a single character encoding such as Latin-1, when it is supposed to be UTF-8. Check your setup, including the french.php language files, to see if your catalog version is specifying Latin-1 (ISO-8859-1) or similar.

 

By the way, if you're just starting out, osC 2.3.3 is quite old. You should be starting with osC 2.3.4.

Link to comment
Share on other sites

"Just to clarify, you're looking at the same text appearing on two different pages (one in admin, the other in public catalog)?"

YES indeed.

 

"What you're seeing with IMMUNITÉ is the text being displayed in UTF-8 encoding, while IMMUNITÉ is the same text being displayed in a single byte encoding, such as Latin-1. Accented letters in UTF-8 are two or more bytes, which show up as a single character on a UTF-8 page, but as multiple characters in Latin-1. For some reason, your catalog page is displaying in a single character encoding such as Latin-1, when it is supposed to be UTF-8. "

Indeed.But after a while also in admin section/catalog/product description the french characters appear different.For example: é become "?"

 

"Check your setup, including the french.php language files, to see if your catalog version is specifying Latin-1 (ISO-8859-1) or similar."

Where should I check setup?Do I check in  admin/tools/define languages?It is strange but I get 401 error:page not found?Maybe this is the reason?

 

"By the way, if you're just starting out, osC 2.3.3 is quite old. You should be starting with osC 2.3.4."

My shop has reactivated after 2 years of absence, and I've started now with addons upgrades. I'll also proceed with OSC2.3.4, maybe all this problems will dissapear.

Link to comment
Share on other sites

There has not been a "define languages" function since osC 2.2. You would need to look in the includes/languages/french.php (or whatever language you're using) files (catalog and admin versions) to see what it's setting the encoding to (setlocale() call). You need to have consistent encoding (and collation) specified for your database and all your web pages, and not a mixture of Latin-1 here and UTF-8 there. If you have been operating the site with a mixture of encodings, you may have to do some manual cleanup in the database to get everything consistent.

Link to comment
Share on other sites

In includes/languages/french.php and also in admin/includes/language/french.php, I had the same settings regarding setlocale():

if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {
  @setlocale(LC_TIME, 'fra');
}else{
  @setlocale(LC_TIME, 'fr_FR.ISO_8859-1');
}

....

// charset for web pages and emails
define('CHARSET', 'utf-8');

 

 

I've changed in both files, fr_FR.ISO_8859-1 with utf-8:

if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {
  @setlocale(LC_TIME, 'fra');
}else{
  @setlocale(LC_TIME, 'utf-8');
}

....

// charset for web pages and emails
define('CHARSET', 'utf-8');

 

 

 

In my database, all items have collation:latin_swedish1. I've changed product description and categories in UTF-8.

I do get the same strange characters on my catalog:

in product name-an example:IMMUNITÉ and also in description of the product I have:"...l est un rôle phytocomplexe de rééquilibrer les mécanismes de défense"

Link to comment
Share on other sites

Hmm. english.php looks nothing like that. Was this site upgraded from some earlier version of osC? In english.php, the line is
 

@setlocale(LC_ALL, array('en_US.UTF-8', 'en_US.UTF8', 'enu_usa'));

 
and CHARSET is the same. Maybe something went wrong in an earlier upgrade?
 
Anyway, you might try LC_ALL instead of LC_TIME, and 'fr_FR.UTF-8' or array('fr_FR.UTF-8', 'fr_FR.UTF8') and see if that helps. If you look at the browser page source for these pages, does the HTML declare ISO-8859-1 (or something else other than UTF-8) as the encoding? It looks like you're feeding UTF-8-encoded text to a page declared to be Latin-1. You'll need to find out why your pages are declared Latin-1 (or similar) instead of UTF-8. Could there be a hard coded Latin-1 in some template?

Link to comment
Share on other sites

I have this inside my french.php

if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {
  @setlocale(LC_TIME, 'fra');
}else{
  @setlocale(LC_TIME, 'fr_FR.UTF-8');
}

and this

// Global entries for the <html> tag
define('HTML_PARAMS', 'dir="ltr" lang="fr"');

// charset for web pages and emails
define('CHARSET', 'utf-8');

My database tables are InnoDB - utf8_unicode_ci.

All seems fine here no broken characters with french.

Link to comment
Share on other sites

Hmm. english.php looks nothing like that. Was this site upgraded from some earlier version of osC? In english.php, the line is

 

@setlocale(LC_ALL, array('en_US.UTF-8', 'en_US.UTF8', 'enu_usa'));

 

and CHARSET is the same. Maybe something went wrong in an earlier upgrade?

 

Anyway, you might try LC_ALL instead of LC_TIME, and 'fr_FR.UTF-8' or array('fr_FR.UTF-8', 'fr_FR.UTF8') and see if that helps. If you look at the browser page source for these pages, does the HTML declare ISO-8859-1 (or something else other than UTF-8) as the encoding? It looks like you're feeding UTF-8-encoded text to a page declared to be Latin-1. You'll need to find out why your pages are declared Latin-1 (or similar) instead of UTF-8. Could there be a hard coded Latin-1 in some template?

 

I've installed OSC 2.3.3 from the beginning, till 4-5 years ago. Next week I'll pursuit to upgrade, maybe this problems will dissapeared.

I followed your suggestions, and also tsimi user's configuration, but nothing changed.

My english.php has:

@setlocale(LC_TIME, 'en_US.ISO_8859-1'), and charset:

// charset for web pages and emails

define('CHARSET', 'utf-8');

 

My sql database settings are:

-Server connection collation: utf_8_general_ci

  • Server: Localhost via UNIX socket
  • Server type: MySQL
  • Server version: 5.5.42-cll - MySQL Community Server (GPL)
  • Protocol version: 10
  • User:***@@localhost
  • Server charset: UTF-8 Unicode (utf8)
Web server
  • cpsrvd 11.50.0.30
  • Database client version: libmysql - 5.1.73
  • PHP extension: mysqli dot.gif
Link to comment
Share on other sites

there is an upgrade script to convert database contents to utf8, admin/database_tables.php - I think you should have run that, and not change the database table directly

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

 

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

 

I'm not sure what this is supposed to accomplish. LC_TIME is supposed to set time and date formatting, so the 'en_US' part may have an effect, but I'm not sure the encoding ('ISO_8859-1') will have any effect on dates and times, and certainly not on general text. Google LC_TIME and LC_ALL.

 

Anyway, you're setting Latin-1 (ISO_8859-1) in one place, and then UTF-8 two lines later. That's not good. Pick one or the other and stick with it throughout your entire site (including the database).

Link to comment
Share on other sites

  • 2 weeks later...

Archived

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

×
×
  • Create New...