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?
Bookmarks