BenPonsford Posted November 29, 2011 Share Posted November 29, 2011 Hey guys & girls Although I've found what I believe to be a few threads already on this topic, they are not in English, which isn't quite so useful for me. The problem is this: lots of text in our database contains double byte UTF-8 characters but PrestaShop does not display these characters as intended (instead, each byte is displayed as an individual character). As far as I can tell, the page source is set to UTF-8, as is the database. For a simple example, I have created two entries for the manufacturer Cébé. One uses extended ASCII (codes: 67, 233, 98, 233) The other uses double byte chars (codes: 67, 195, 169, 98, 195, 169) In my test module, which loads these values from the database and then displays on screen, the output is: C�b� Cébé Exactly as expected. In the shop front, however, I unfortunately get the following: Cébé Cébé What do I need to do in order to have these (and other) double byte characters display correctly in the shop front? I have tried removing "|escape:'htmlall':'UTF-8'" from the Smarty template where these characters are output, but that made no difference. Thanks for any help you can provide. Edit: I should add, the field, table and database collations are all set to "utf8_general_ci", yet I get the same problem viewing the data in phpMyAdmin, and in a feed I create from the database. Perhaps the question should be, why do the characters display correctly in my module? Link to comment Share on other sites More sharing options...
El Patron Posted November 29, 2011 Share Posted November 29, 2011 All web pages display this content must set the charset to UTF-8. <head> <meta http-equiv=Content-Type content="text/html; charset=utf-8"> ... </head> note: make sure to set smarty recompile on so you will see your changes...also make sure to set compile off when finished... hope this is what you were looking for. Link to comment Share on other sites More sharing options...
BenPonsford Posted November 29, 2011 Author Share Posted November 29, 2011 Hi elpatron I already have this in the header for all pages: <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> While phpMyAdmin has: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> Yet both are broken. The latter is exactly the same as my module that does work. Link to comment Share on other sites More sharing options...
BenPonsford Posted November 29, 2011 Author Share Posted November 29, 2011 Finally sussed it, only taken me two days! Not PrestaShop's fault in the end either. In the module that wrote the information into the database (and I was using to debug with), there was a call to mysql_set_charset(), which was passed "latin1" (now fixed to "UTF-8"). Hence when it read the text out, it was re-converted and thus looked correct, but the store itself was actually doing the right thing, and showing it as it truly was. 1 Link to comment Share on other sites More sharing options...
El Patron Posted November 29, 2011 Share Posted November 29, 2011 Finally sussed it, only taken me two days! Not PrestaShop's fault in the end either. In the module that wrote the information into the database (and I was using to debug with), there was a call to mysql_set_charset(), which was passed "latin1" (now fixed to "UTF-8"). Hence when it read the text out, it was re-converted and thus looked correct, but the store itself was actually doing the right thing, and showing it as it truly was. I have had days just like that!...glad you sussed it out... Link to comment Share on other sites More sharing options...
jstepp28 Posted May 10, 2014 Share Posted May 10, 2014 So as I understand it each module could be setup to use its own connection string and character encoding? If I am using PDO MySQL would I be able to set an application wide connection string to ensure that everything is UTF-8 encoded? I'm trying everything I know and keep getting  every time I have a double space in a product description. I did enter the following in to header.tpl: <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta charset="utf-8"> I see that it is peppered throughout the header.tpl file so I assumed that was telling the app to format the data correctly. I just want this to line up and I'm not a developer more of a systems engineer. The things I've read tell me that the tables need to be utf8, collation needs to be utf8, and connection needs to use utf8 encoding. Here is mysql variables that are set in my.cnf: mysql> SHOW VARIABLES LIKE '%character%'; +--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ 8 rows in set (0.01 sec) Any help would be appreciated. Thanks, J Stepp Link to comment Share on other sites More sharing options...
Recommended Posts