2

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!

1 Answer 1

2

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' 
3
  • 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. Commented Mar 2, 2012 at 11:44
  • 1
    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. Commented Mar 2, 2012 at 11:56
  • Thanks. I had to run pg_dropcluster first before running initdb. Commented Mar 2, 2012 at 12:17

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.