Comment 10 for bug 331065

Revision history for this message
SeanBoran (sean-boran) wrote :

I've ubuntu 8.04 with postgres 8.3.
The locale was en_US in /etc/default/locale, change that to LANG="en_US.UTF-8" and rebooted.
The "locale" command return the new value for root, postgres, openerp users etc.

Still getting in the postgres log:
2010-08-03 14:01:50 CEST ERROR: encoding UTF8 does not match server's locale en_US
2010-08-03 14:01:50 CEST DETAIL: The server's LC_CTYPE setting requires encoding LATIN1.
2010-08-03 14:01:50 CEST STATEMENT: CREATE DATABASE "sean1" ENCODING 'unicode' TEMPLATE "template0"

In /etc/postgresql/8.3/main/postgresql.conf found 4 lc_ settings = 'en_US'.
Changed those to en_US.UTF-8 and restarted postgres. Still the same error message as above

Next used psql as the postgres user:
postgres=# initdb -E en_US.UTF-8

Didn't help either. But the following did work:

Stop postgres, kill my current cluster, reinit and restart:
/etc/init.d/postgresql-8.3 stop
cd /var/lib/postgresql/8.3
mv main main.old
mkdir main
su - postgres
locale (make sure you have en_US.UTF-8)
/usr/lib/postgresql/8.3/bin/initdb -D /var/lib/postgresql/8.3/main
cd main
ln -s /etc/postgresql-common/root.crt root.crt
ln -s /etc/ssl/certs/ssl-cert-snakeoil.pem server.crt
ln -s /etc/ssl/private/ssl-cert-snakeoil.key server.key
/etc/init.d/postgresql-8.3 start

# Test:
su - postgres
psql
postgres=# CREATE DATABASE "test3" ENCODING 'unicode' TEMPLATE "template0";
postgres=# drop database test3;
chown postgres:postgres main

Finally start Openerp, create DBs: all is sweet.

So, basically I'd say make sure that locale is right BEFORE installing postgres :-)