Zen Cart Logo
Forums / Addon Language Packs / Charset Important Message

Charset Important Message

Locked

Views: 9,983

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
31 Aug 2006, 9:59 AM
#1
brainiack avatar

brainiack

New Zenner

Join Date:
Aug 2006
Posts:
6
Plugin Contributions:
0

Charset Important Message

After strugling with the French language where my database-words where displayed correctly but my .php files not and when i changed the CHARSET of my pages it just changed the problem (Mysql data displayed wrong and the PHP correct) i finaly found out what was causing this problem.

For the French language this works in french.php (/includes/languages/YOUR_LANGUAGE.php)

// look in your $PATH_LOCALE/locale directory for available locales..
// on RedHat try 'en_US'
// on FreeBSD try 'en_US.ISO_8859-1'
// on Windows try 'en', or 'English'
@setlocale(LC_TIME, 'ISO_8859-1');
define('DATE_FORMAT_SHORT', '%m/%d/%Y');  // this is used for strftime()
define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime()
define('DATE_FORMAT', 'm/d/Y'); // this is used for date()
define('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S');

////
// Return date in raw format
// $date should be in format mm/dd/yyyy
// raw date is in format YYYYMMDD, or DDMMYYYY
function zen_date_raw($date, $reverse = false) {
  if ($reverse) {
    return substr($date, 3, 2) . substr($date, 0, 2) . substr($date, 6, 4);
  } else {
    return substr($date, 6, 4) . substr($date, 0, 2) . substr($date, 3, 2);
  }
}


// if USE_DEFAULT_LANGUAGE_CURRENCY is true, use the following currency, instead of the applications default currency (used when changing language)
define('LANGUAGE_CURRENCY', 'EUR');

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

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

BUT THAT IS NOT ALL !!

If you are using ISO_8859-1, make sure you are saving your .php files as ANSI and not UTF-8!! (UTF-8 should only be used if you're also setting CHARSET to UTF-8 )

Within notepad for example you can select this when you choose "save as" and then select the dropdown "coding".

I specialy had to do this with some .php files i received by email from a collegue.

:jawdrop:

2 Feb 2010, 1:20 PM
#3
dutchkiwis avatar

dutchkiwis

New Zenner

Join Date:
Sep 2008
Posts:
20
Plugin Contributions:
0

Re: Charset Important Message

Brainiack,
Your fix works for me.
THANKS DUDE :clap:

18 Jul 2011, 6:10 PM
#4
mcgill avatar

mcgill

Zen Follower

Join Date:
Aug 2005
Posts:
101
Plugin Contributions:
0

Re: Charset Important Message

Hi
having been struggling for what seems the beginning of time I would like to share my solution to the french problem. ( nukenem is the best solution but a bit expensive)

1 - srw2d.com/sites/default/files/utf-8-zen-cartV1.3.8.pdf the bit in factory_query.php is a must

2 You can change the database collation in an existing installation in phpadmin by downloading it and doing a find and replace.

3 The reason why notepad and other text editors bugger up the code when saving as utf is because they put a hidden "BOM" marker in the file and saving as ansi still doesn't solve all the characters. The solution is UCAST Express its free and you can batch convert the files WITHOUT the bom marker get it here http://www.rotatingscrew.com/downloads.aspx

I dont know the company and THIS IS NOT SPAM.

This will save DAYS and DAYS of misery struggling believe me. Im no guru by anymeans but if your about to give up try this it works .... well it did for me.

18 Jul 2011, 6:37 PM
#5
drbyte avatar

drbyte

Sensei

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

Re: Charset Important Message

  1. v1.3.9 already has all that built-in
  2. be VERY careful blindly changing collation, as it will often damage existing multibyte characters
  3. There are many text editors capable of saving UTF8-without-BOM, including Notepad++ and Crimson Editor, both of which are oft recommended for Zen Cart users. http://notepad-plus.sf.net