UTF-8 setup (again) – for Debian Squeeze

This post is mostly for my own reference – but maybe you will find it useful. Here are my current Linux, Apache, MySQL, PHP settings for supporting UTF-8 properly!

Linux
—–

# dpkg-reconfigure locales

I chose: en_NZ.UTF-8 UTF-8

Apache
——

edit file /etc/apache2/conf.d/charset
uncomment the line:
AddDefaultCharset UTF-8

MySQL
—–

make sure these settings are in /etc/mysql/my.cnf:

[mysqld]
character_set_server=utf8
collation_server=utf8_unicode_ci

[client]
default-character-set=utf8

PHP

make sure these settings are in /etc/php5/apache2/php.ini and /etc/php5/cli/php.ini:

default_charset = utf-8

And in all scripts, when you make the mysql connection, always do this:

mysql_set_charset(‘utf8’);

2 thoughts on “UTF-8 setup (again) – for Debian Squeeze”

Leave a Reply

Your email address will not be published. Required fields are marked *