Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

French charset issue.


willer2k

Recommended Posts

Hello!

 

I have a problem with my website, my french charset doesn't work properly.

The entire websites charset is fine, except for when I add products from admin or when I add categories, all french characters turn into weird symbols.

 

For exemple, "Qualité" turns into "Qualité"

 

I changed my database collation from latin_swidish_1 to UTF8 in "operations" and notthing...

 

Any advice? :(

Link to comment
Share on other sites

Hi Lyosha

 

you need to check both your DB encoding/collation and your language file charset.

I don't know what other languages you're using but for French the DB should either be latin_swidish_1 or UTF8, the language files charset should either be iso-8859-1 or UTF8.

 

Look for the following code: includes>languages>french.php, edit that if you want to use UTF8.

 

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

 

Another thing, it's always good practice to use html codes in place of special characters, because this way they get displayed correctly regardless of the page being in iso-8859-1 or utf8, and if you ever import your DB one day and make a mistake and use the wrong encoding, the html codes will still be there no problem, but the special characters, especially accented ones, might get deleted in the DB then you have to re-enter them all manually in the DB.

 

I can only speak for French, Italian and German, for other languages like Russian that uses cyrillic characters, I do not have any experience on that.

 

Here's a thread with some explanations and suggestions, especially towards the end:

http://www.oscommerce.com/forums/topic/302941-french-letter-before-every-price-a/page__hl__french%20characters

 

Here's a site with explanations on foreign characters and their html codes:

http://tlt.its.psu.edu/suggestions/international/web/codehtml.html

~ Don't mistake my kindness for weakness ~

Link to comment
Share on other sites

Hey isa! How are you? @@Biancoblu

 

So i found the charset, at french.php its set as iso-8859-1, I changed it to UTF8 and it fixed the issue, but now the entire website had all the "é" symbols replaced with "?" symbols. So it fixed the smaller issue and created a much bigger issue lol :(

 

I tried to change my database colaltion aswell just like it says on the posts but no success :(, maybe i am doing it wrong? I'll keep reading, but if you have any other advice, plz submit them :D

 

Note that it does that ONLY when I input french product info or french categories. You think it might be something with my admin charset??

Link to comment
Share on other sites

Whatever encoding you choose for the DB you need to make sure it's all the same: all the tables, all the text fields, all the data, etc. I wouldn't mix and match encodings within one same DB.

 

but now the entire website had all the "é" symbols replaced with "?" symbols

 

Check the texts in the actual DB in PHPMyadmin, if you have "?" in place of "é", the special characters got deleted sometime when you edited it, or have you imported it from somwehere?

If you have question marks inside the DB then you'll have to manually enter the characters back in, and like I said you'd be better off using html entities.

 

What I did when I re-did my site is I kept many versions of my DB with various collations and encodings, and did a lot of testing, as the more I read about it the more I found that there are various solutions to this problem.

~ Don't mistake my kindness for weakness ~

Link to comment
Share on other sites

Forgot to say that you need to use the same language file charset both for admin and front end, or you'll get funny symbols in admin too, but what really counts is the front end, and that depends on the DB encoding and page encoding.

~ Don't mistake my kindness for weakness ~

Link to comment
Share on other sites

I think u are right, HTML entities are the way to go. Thanks a bunch ;)

 

No, what your problem is that you have a mismatch between character set encodings. All of your database text fields need to be the same encoding (typically either ISO-8859-1/Latin-1 or UTF-8). Your language support file(s) (labels and prompts) need to be the same encoding. Your pages need to be displayed in the same encoding. Imported data (such as via EasyPopulate) needs to be in the same encoding. Older data in the database needs to be changed to the new encoding (phpMyAdmin has commands to change a field encoding while translating all the data in it). Any data brought into the database directly with phpMyAdmin -- be careful about specifying what encoding the source .sql file is written in.

 

In your first post, you were showing a UTF-8 encoded text field being displayed on a Latin-1 page. While you can use HTML entities (e.g., é), they're generally not practical unless 1) you have very few to do, and 2) your keyboard doesn't directly support them.

Link to comment
Share on other sites

HTML entities are indeed the best solution for entering texts, as the foreign character will show correctly regardless of page encoding. It's no big deal getting used to that either and there are text editors that you can install in shop admin that enter HTML entities for you. I use FCK editor.

 

I use UTF8 encoding for the database and ISO-8859-1 for the language files, all my characters display correctly and have done so since 2006.

~ Don't mistake my kindness for weakness ~

Link to comment
Share on other sites

Well I dare not argue about accented characters, with a lady who lives in Switzerland.

But php's 'htmlentities' function could be inserted into the code, to process text that is to be displayed.

As for the original problem, and its partial solution, we are unsure whether the question mark is something that has been inserted by the browser to signify an unrecognised character.

willer2k could look into the html to find out.

Link to comment
Share on other sites

Thanks for your help guys! :)

@@Biancoblu HTML entities fixed the issue, I think its best practices anyways to use HTML entities, if only I knew about them before I started my website, my entire french side of the website would of been built with HTML entities :)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...