Search code examples
mysqltinybutstrong

tinybutstrong not showing special characters from mysql


I'm trying to load data from a MySQL DB from a varchar(35) / utf8_swedish_ci field through TBS (tinybutstrong) and PHP using the example (MySQL data merge). My issue is that data loads fine if only ascii characters are in the fields but as soon as I add a single scandinavian special character like ö or ä the field contents vanishes entirely and other fields in row display correctly.

My understanding is that the latest versions on TBS automatically use UTF-8 coding (I have 3.9.0 for PHP 5) so I assumed it would work out-of-the-box. To be safe, I even added the coding to template as so:

'$TBS->LoadTemplate('mysql.html','UTF-8');' but to no avail.

Could someone please advice what is causing this.


Solution

  • For a good UTF-8 processing, all elements of the chain must be UTF-8.

    You have to ensure that your template is UTF-8 : check the entered text and the HTML element <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    You have to ensure that all your PHP scripts are UTF-8 and not Ansi.

    You also have to ensure that your MySQL connection is set to receive UTF-8 queries and to return UTF-8 item data. This can be done for example by querying the SQL : SET NAMES 'UTF8'