Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2010
    Posts
    11
    Plugin Contributions
    0

    Default Charset settings works for template content but not for product descriptions.

    I am new to ZenCart and relatively new to php/MySQL. I have installed ZenCart ( www.sunriseledlight.com/shop ) with English, Norwegian, German and Spanish languages. My ZenCart version is 1.3.9d, and I am using the template ZenCartJquery Silver. The MySQL collation is UTF8_general_ci and I have been studying for two days now without finding any solution to my problem.

    I also have to say that I am keeping one "Development" server at home, as well as one "production" server at a public host, so that I have been able to do a lot of trial and error in my localhost environment. Ok, Here we go:

    The original installation was with english language, and in iso8859-1 which in plain text is called latin1, I have later come to understand. This was problem free. I configured the whole shop with categories, products, the whole lot, before I started installing more language packs. Norwegian language pack was installed, no problem. I could translate the text from english to Norwegian, and all the special characters worked. But then I got to Spanish and German, and that really ruined the whole day... The menus, the text around the buttons, the headline text in the boxes all translated perfectly to all the accented signs, no problems there. But the text that I entered, like product descriptions and the like, turned to strange unreadable signs. So I started to check for possible solutions.

    One of the things I learned was that ideally, the MySQL database should be in UTF8, since this is more universal than iso8859-1. So I set about to convert my database to utf8. This was easier said than done, but since I have my little localhost here that I can blow up without anyone suffering any damage, I simply dumped all the tables to a textfile, ran it through some search and replace procedures until i managed to get a file that I could import back in, that now was in the utf8 format. The shop looked the same, all the articles are there, everything works, so I guess the operation was a resounding success. Well, except for one thing: The characters in Spanish and German were still exactly the same!

    New angle on the problem: The http header. Set the language in the browser, is a proper fix, I found out after some more google - ing. Ok here we go, change the main language definition files: spanish.php and german.php . The CHARSET definition there was utf8, so just for fun I tried to change them to latin1. And guess what? IT WORKED! Now the product description text had all the special signs and characters, and I was just thrilled to have solved the problem.

    But hey, wait.... eh... what is that strange sign there in the headline of the side box? InformaciÃ3n? now what? It turns out that now I have turned the whole problem upside down. Now the text that I myself have entered - like the product descriptions - are ok, but everything else is not! Somehow this halfway solution looks better, because the errors are more numerous in the product texts, but I suspect that this is not really a solution, quite the contrary in fact.

    I have a sneaking suspicion that this all has something to do with the initial installation having been in iso8859-1 and the database having been converted to utf8 later, perhaps not even converted, it can be that my method of "converting" just converted the description of the tables from Latin1 to utf8, perhaps the data in there is still latin1. But if this is true, how can I explain that now, if I go in and erase a text, and then type it back in, the same errors are still there? Even so, according to most people, even the latin1 collation should give the correct results in ZenCart because of the charset definitions in the html header set in the "your_language.php" files. I even tried to import an old backup of the database with all the tables in latin1 - same difference. Absolutely the same result.

    I am sort of knocking my head against a wall here, and it is kind of starting to hurt a bit. I feel that I am SO close to solving this, I have also learned a lot about the CHARSET issues out there (I have read many of your posts Vger) Does anyone out there have a clue? Please?

  2. #2
    Join Date
    Jul 2010
    Posts
    5
    Plugin Contributions
    0

    red flag Re: Charset settings works for template content but not for product descriptions.

    I have the exact same problem here.... I have spanish language pack installed - only the product descriptions show little squares instead of special/accented characters. Read a lot of charset info here and its making my head swim now

    anyone found a solution yet to this?

  3. #3
    Join Date
    Jul 2010
    Posts
    11
    Plugin Contributions
    0

    Default Re: Charset settings works for template content but not for product descriptions.

    Quote Originally Posted by bootz69 View Post
    I have the exact same problem here.... I have spanish language pack installed - only the product descriptions show little squares instead of special/accented characters. Read a lot of charset info here and its making my head swim now

    anyone found a solution yet to this?
    Bootz69:
    I may be able to shed some light on the situation myself. What I finally did, and what seems to work, is to do a completely new, clean install of ZenCart, and configure it to run in utf8 to begin with. I found a guide to doing it somewhere here on this forum, the link is here: http://www.zen-cart.com/forum/showthread.php?t=93439

    Follow these steps carefully, they did work for me, after a fashion. I also found out that when the Zen Cart was installed, I could import the database that I had converted to utf8 via the export to text file dump and run search and replace on the collation values, actually worked, when I imported the database, so that saved me a whole lot of work.

    The only thing that is now giving me problems in my site is the Norwegian charset, and not from the database, but from the php files. The german, english and spanish all live happily together, both in the database and in the php files.

    There is one little - rather obvious for seasoned programmers - factor I would like to call your attention to: If you - as you would do if you are sensible - are on ZenCart 1.3.9, you have to see this link here: http://www.zen-cart.com/forum/showthread.php?t=153582 . It tells you to NOT modufy the query_factory.php, but instead to create a separate file... well, read the thread. At first I did this, and simply couldn't make it work, the whole website stopped working. For a non- programmer like me, it was not so obvious that the php code needed a php closing tag, since the closing tag was omitted in the example!

    Good luck!

  4. #4
    Join Date
    Jul 2010
    Posts
    5
    Plugin Contributions
    0

    Have a Drink Re: Charset settings works for template content but not for product descriptions.



    Thankyou sjur.hemma!

    I created my_db_charset.php files (being careful to put the closing php tags in!) and it works like a dream!

    saved me a lot of work





    check it out at spanishartisan

    its a work in progress

  5. #5
    Join Date
    Jul 2010
    Posts
    4
    Plugin Contributions
    0

    Default Re: Charset settings works for template content but not for product descriptions.

    Quote Originally Posted by sjur.hemma View Post
    Bootz69:

    There is one little - rather obvious for seasoned programmers - factor I would like to call your attention to: If you - as you would do if you are sensible - are on ZenCart 1.3.9, you have to see this link here: http://www.zen-cart.com/forum/showthread.php?t=153582 . It tells you to NOT modufy the query_factory.php, but instead to create a separate file... well, read the thread. At first I did this, and simply couldn't make it work, the whole website stopped working. For a non- programmer like me, it was not so obvious that the php code needed a php closing tag, since the closing tag was omitted in the example!

    Good luck!
    And I thank you too sjur.hemma for the link - putting utf8 in as your_charset_here also worked perfectly for German

    regards

    Jack

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

    Default Re: Charset settings works for template content but not for product descriptions.

    Quote Originally Posted by sjur.hemma View Post
    For a non- programmer like me, it was not so obvious that the php code needed a php closing tag, since the closing tag was omitted in the example!
    The closing php tag is NOT required:
    https://www.zen-cart.com/tutorials/i...hp?article=313
    .

    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. v139h Attribute image swap - works for one option, but not another
    By jgold723 in forum Setting Up Categories, Products, Attributes
    Replies: 4
    Last Post: 21 Nov 2012, 11:01 PM
  2. Add To Cart works for some products but not others!! HELP!
    By arniesbarmyarmy in forum General Questions
    Replies: 8
    Last Post: 29 Nov 2009, 11:29 PM
  3. Freeshipper works for ot_shipping at $35 but not over!
    By SeanLoberg in forum Built-in Shipping and Payment Modules
    Replies: 5
    Last Post: 18 Apr 2009, 03:09 PM
  4. "Sorry, we do not ship to your region at this time" works for me but not client??
    By infocom in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 30 Jan 2009, 02:32 PM
  5. USPS mod works but not for canada ?
    By snarkys in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 13 Oct 2007, 05:15 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