Jump to content

Utf8: Difference between revisions

From NusaATK
New page: {{achievo_howto|Easy|Jeroen van Sluijs <jeroenvs@ibuildings.nl>}} == Intro == If you see strange characters in your application, like 'This is � special char', you probably use a n...
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{achievo_howto|Easy|[[Jeroen van Sluijs]] <jeroenvs@ibuildings.nl>}}
#REDIRECT [[Using_UTF8_in_applications]]
 
== Intro ==
 
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 ==
=== Database ===
Make sure you create your database with 'MySQL connection collation:' set to ''''utf8_unicode_ci'''', so each table has this collation type.
 
=== config.inc.php ===
Add the following code to your config.inc.php:
$config_db["default"]["charset"]  = "utf8";
$config_default_charset = "utf-8";
 
=== module_preload.inc ===
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:
  $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.
 
== Checking ==
After reloading your website, you should see the ''Unicode (UTF-8)'' option selected (in firefox: View > Character Encoding).
 
[[Category: Achievo Howtos]]

Latest revision as of 08:45, 30 June 2008