Using UTF8 in applications
From ATK Wiki
If you see strange characters in your application, like 'This is � special char', you probably use a non-utf8 charset. In this howto I will explain how to make a project with UTF-8 support.
3 simple steps
Make sure you create your database with 'MySQL connection collation:' set to 'utf8_unicode_ci', so each table has this collation type.
Add the following code to your config.inc.php:
$config_db["default"]["charset"] = "utf8"; $config_default_charset = "utf-8";
For each language you use, you'll have to set the 'charset' in the corresponing languagefile in atk/languages. Since it is not possible to commit these languagefiles in your project, you can solve this as follows:
Add this code to a module_preload.inc to override the 'charset' in your languagefile (in the global scope, not in a function!):
<?php $lang = atkinstance("atk.atklanguage"); $lang->setText("charset", "utf-8", "en"); $lang->setText("charset", "utf-8", "nl"); ?>
The module_preload.inc is always loaded, to these settings will apply to the complete application.
After reloading your website, you should see the Unicode (UTF-8) option selected (in firefox: View > Character Encoding).