Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

So I've been looking to install trac on my debian server with PostgreSQL. I setup everything as per the docs but when trying to run trac-admin /path initenv I get this error for database encoding:

DataError: character 0xe282ac of encoding "UTF8" has no equivalent in "LATIN1"

From further reading (and after seeing all my databases are set to encoding "LATIN1") it seems I need to change to UTF8, but how can I do this?

If I create my database like so:

createdb -U user -O user -E UTF8 trac

I get:

createdb: database creation failed: ERROR:  encoding UTF8 does not match server's local en_GB
DETAIL: The server's LC_CTYPE setting requires encoding LATIN1.

It looks like it should be easy to fix by changing the encoding but after searching for a bit I have no idea how to do this!

share|improve this question

1 Answer 1

up vote 2 down vote accepted

It seems to be you database cluster have LATIN1 locale. When you are setting cluster, you can add --locale parameter - see this document for more informations. Your databases will be created according to this parameter.

Some locale parameters you can set in the configuration file. For example my settings from /etc/postgresql/9.1/main/postgresql.conf:

lc_messages = 'cs_CZ.UTF-8'                     # locale for system error message strings
lc_monetary = 'cs_CZ.UTF-8'                     # locale for monetary formatting
lc_numeric = 'cs_CZ.UTF-8'                      # locale for number formatting
lc_time = 'cs_CZ.UTF-8'
share|improve this answer
I used apt-get install to install PostgreSQL so I never initialised any clusters myself. It wont let me run init.db because I get permission deined. If I try as root it also refuses. – ing0 Mar 2 '12 at 11:44
You have to drop cluster and init a new one. And you have to do it under postgres user, or your postgres will not start. See pg_lsclusters, pg_dropcluster and pg_createcluster commands (and theire's man pages eventually). Or you can set your system locales to the en_US.UTF-8 (or somethink like it) and then do apt-get install for postgresql. – Jan Marek Mar 2 '12 at 11:56
Thanks. I had to run pg_dropcluster first before running initdb. – ing0 Mar 2 '12 at 12:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.