Change LC_CTYPE for PostgreSQL and PostGIS use

a.m. picture a.m. · Dec 2, 2011 · Viewed 17.4k times · Source

So I'm walking through the GeoDjango tutorial and I'm stuck on this error message:

postgres@lucid32:~$ createdb -E UTF8 template_postgis
createdb: database creation failed: ERROR:  encoding UTF8 does not match locale en_US
DETAIL:  The chosen LC_CTYPE setting requires encoding LATIN1.

I've googled and read some Ubuntu docs but to no avail. Any insight would be greatly appreciated!

I'm using the default Vagrant Box lucid 32, for testing out my setup.

Answer

Peter Eisentraut picture Peter Eisentraut · Dec 2, 2011

It is better to just specify the locale for the database and have the encoding be figured out from that. So use something like

createdb --locale=en_US.utf8 template_postgis