Encoding and Character Sets in Koha

From Koha Wiki

Jump to: navigation, search
Home > Documentation
Home > Documentation
Home > Documentation
Home > Documentation > Installation
Koha > Technical > Administration
Tips & Tricks > Tips & Tricks/Customising Notices and Slips > Tips & Tricks

MySQL

At a bare minimum, for MySQL make sure you have the following in the [mysqld] section of your /etc/mysql/my.cnf:

init-connect = 'SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_general_ci
character_set_client=utf8

Then restart mysql with: /etc/init.d/mysql restart

See also: MySQL 5.1 Reference Manual :: 9.1 Character Set Support for information about choosing different collations (which will affect how some things are sorted in Koha).

Apache

For Apache make sure you have these lines in your /etc/apache2/httpd.conf (or for ubuntu in /etc/apache2/conf.d/charset ):

AddCharset UTF-8 .utf8 
AddDefaultCharset utf-8

Then restart apache with: /etc/init.d/apache2 restart

Locale

Your locale should be set to UTF-8. This step is very important for a UNICODE compliant system.

Run the Locale command and it should show you using UTF-8:

$ locale
LANG=en_PH.UTF-8
LANGUAGE=
LC_CTYPE="en_PH.UTF-8"
LC_NUMERIC="en_PH.UTF-8"
LC_TIME="en_PH.UTF-8"
LC_COLLATE="en_PH.UTF-8"
LC_MONETARY="en_PH.UTF-8"
LC_MESSAGES="en_PH.UTF-8"
LC_PAPER="en_PH.UTF-8"
LC_NAME="en_PH.UTF-8"
LC_ADDRESS="en_PH.UTF-8"
LC_TELEPHONE="en_PH.UTF-8"
LC_MEASUREMENT="en_PH.UTF-8"
LC_IDENTIFICATION="en_PH.UTF-8"
LC_ALL=

If so, there is nothing more to do.

If it is not set to something UTF-8, determine what locales are installed:

$ locale -a

Select one (note that utf8 becomes UTF-8) and use it:

$ sudo update-locale LANG=en_US.UTF-8

Log out and log back in to see the locale change reflected when you use the locale command.

Recheck that your locale ends in UTF-8 now.

$ locale
Personal tools