Thread: UTF 8 Problem

Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2010
    Posts
    263
    Plugin Contributions
    0

    Default UTF 8 Problem

    Hi,

    I am using version 1.3.9 h, working on www.test.betparagon.com. I would like the site to be available in 2 languages, English and Thai.

    I have followed the instructions provided here: http://srw2d.com/sites/default/files...cartV1.3.8.pdf, and created my site. Everything showed fine until I tried to change i.e. Home to หน้าแรก on my includes/ languages/thai/custom/header.php. When I tried to save it, my system said the characters will be lost. I downloaded a copy, saved it as UTF-8 encoding, and re-uploaded. On the sport betting page, my text displayed correctly in Thai, the moment I uploaded my new header.php, my text turned into symbols, but the first heading is now showing Home in Thai. How can I fix this?

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,913
    Plugin Contributions
    96

    Default Re: UTF 8 Problem

    1. Make sure that your language .PHP files are saved using UTF-8 without BOM. If you're using Notepad++, click Settings->Preferences and then click the New Document/Default Directory tab. Choose UTF-8 without BOM in the Encoding area and also check "Apply to opened ANSI files".
    2. Make sure that the CHARSET definition in your templates english.php and thai.php files specify a form of utf-8.

  3. #3
    Join Date
    Apr 2010
    Posts
    263
    Plugin Contributions
    0

    Default Re: UTF 8 Problem

    Hi,

    Thanks for the reply. I have already updated my english.php and thai.php files with the required utf-8 code as per the pdf, I also did a new install and set Operations to the utf one. I have also now downloaded Notepad++. I have downloaded the file for sport betting (includes/languages/thai/custom/sport_betting.php), and opened it with Notepad++ (I have added the settings to Notepad++ before I opened this file), closed it and re-uploaded it, but it is still showing the strange characters. In my database, the main code is utf-8, however when I look at my database tables, it shows latin1_general_ci. Will I have to go into my database and change each one manually to utf8?

  4. #4
    Join Date
    Apr 2010
    Posts
    263
    Plugin Contributions
    0

    Default Re: UTF 8 Problem

    Or should I download all my language files from the server, open them with Notepad++, and re-upload?

  5. #5
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,913
    Plugin Contributions
    96

    Default Re: UTF 8 Problem

    Quote Originally Posted by barendfaber View Post
    Hi,

    Thanks for the reply. I have already updated my english.php and thai.php files with the required utf-8 code as per the pdf, I also did a new install and set Operations to the utf one. I have also now downloaded Notepad++. I have downloaded the file for sport betting (includes/languages/thai/custom/sport_betting.php), and opened it with Notepad++ (I have added the settings to Notepad++ before I opened this file), closed it and re-uploaded it, but it is still showing the strange characters. In my database, the main code is utf-8, however when I look at my database tables, it shows latin1_general_ci. Will I have to go into my database and change each one manually to utf8?
    Step 1: Backup both your files and your database!
    Step 2: Since your database still shows latin1_general_ci, your database is not fully utf8. You'll need to run a utility script (either the one provided by DrByte, http://www.zen-cart.com/downloads.php?do=file&id=1280, or the one provided by a_berezin, http://www.zen-cart.com/downloads.php?do=file&id=1318). I've used the latter one with good success, but others have had issues.
    Step 3: Make sure that both your language files specify the CHARSET as a form of utf-8.
    Step 4: Make sure that both your configure.php files specify a DB_CHARSET of utf8.

    Quote Originally Posted by barendfaber View Post
    Or should I download all my language files from the server, open them with Notepad++, and re-upload?
    There might be a macro that you could create with the more recent version of Notepad++ (google notepad++ convert to utf8); previous versions had a problem. Barring that: it's best to open each language file, save as UTF8 and re-upload.

  6. #6
    Join Date
    Apr 2010
    Posts
    263
    Plugin Contributions
    0

    Default Re: UTF 8 Problem

    Hi,

    OK, it took a bit of time but this what I have done:

    1. In phpMyAdmin, Operations, my Collation: is utf8_general_ci.
    2. I have run the document you recommended, and all tables how show utf8_general_ci.
    3. I have updated my admin/includes/languages/english.php and admin/includes/languages/thai.php to setlocale(LC_TIME, 'en_US.utf8'); and define('CHARSET', 'utf-8'); (I tried to look for setlocale for Thai but could not find any, could this possibly be the problem?).
    4. I have updated my includes/languages/english.php and includes/languages/english.php to @setlocale(LC_TIME, 'en_US.utf8'); and define('CHARSET', 'utf-8');.
    5. I have updated both configure.php files to include at the bottom define('DB_CHARSET', 'utf8');.
    6. I have added my_db_charset.php containing <?php define('DB_CHARSET', 'utf-8'); to both admin/includes/extra_configures and includes/extra_configures.
    7. I have worked through both my admin/includes/languages files as well as includes/languages files with Notepad++, and have converted all to utf-8 without BOM, and re-uploaded.

    Unfortunately, it still shows weird characters (http://www.test.betparagon.com/index...ng&language=th). It does not show the squares, diamonds and questions marks, but please see what the page looks like. I feel I am getting closer to a fix, could you please just have a look again and let me know if I have done something wrong / need to do something else?

  7. #7
    Join Date
    Apr 2010
    Posts
    263
    Plugin Contributions
    0

    Default Re: UTF 8 Problem

    Sorry, my mistake. During the switch over it seems my text in CKEditor (define pages editor) were changed over to these weird characters. I have uploaded the original text and all is good now! Thanks for your help.

 

 

Similar Threads

  1. Small Problem with UTF-8
    By Asdesign in forum Addon Language Packs
    Replies: 1
    Last Post: 16 Mar 2010, 06:18 PM
  2. Problem with IE and UTF-8
    By chaliits in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 7 Feb 2010, 11:00 AM
  3. UTF-8 Problem
    By mireka in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 10 Jun 2006, 12:59 AM

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