Results 1 to 5 of 5
  1. #1
    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)

    Code:
    // 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.


  2. #2
    Join Date
    Sep 2006
    Posts
    542
    Plugin Contributions
    0

    Default Re: Charset Important Message


  3. #3
    Join Date
    Sep 2008
    Posts
    20
    Plugin Contributions
    0

    Default Re: Charset Important Message

    Brainiack,
    Your fix works for me.
    THANKS DUDE

  4. #4
    Join Date
    Aug 2005
    Posts
    100
    Plugin Contributions
    0

    Default 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.
    Only a fool say's money doesn't matter. No rich man ever starved to death.

  5. #5
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default 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
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. v151 functions_email.php Charset CHARSET : "iso-8859-1" or UFT-8
    By Peace Freak in forum Upgrading to 1.5.x
    Replies: 2
    Last Post: 12 May 2013, 02:02 AM
  2. v139h Site-Wide Important Message
    By Lanbo in forum General Questions
    Replies: 2
    Last Post: 23 May 2012, 04:48 PM
  3. Charset
    By Yen_JS in forum General Questions
    Replies: 2
    Last Post: 29 Dec 2010, 03:54 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR