Problem:
(postgres)-# create database "newdb" WITH ENCODING = 'UTF8' LC_CTYPE='en_US.utf8' LC_COLLATE='en_US.utf8' TEMPLATE template0;
createdb: database creation failed: ERROR: encoding UTF8 does not match locale en_US
DETAIL: The chosen LC_CTYPE setting requires encoding LATIN1.
1 2 3 |
(postgres)-# create database "newdb" WITH ENCODING = 'UTF8' LC_CTYPE='en_US.utf8' LC_COLLATE='en_US.utf8' TEMPLATE template0;
createdb: database creation failed: ERROR: encoding UTF8 does not match locale en_US
DETAIL: The chosen LC_CTYPE setting requires encoding LATIN1.
|
Check what locales you have
# locale -a
C
C.UTF-8
en_US
en_US.iso88591
POSIX
1 2 3 4 5 6 |
# locale -a
C
C.UTF-8
en_US
en_US.iso88591
POSIX
|
If locales are not installed:
# apt-get install debconf
1 |
# apt-get install debconf
|
To add en_US.UTF8, run:
# dpkg-reconfigure locales
1 |
# dpkg-reconfigure locales
|
And select the locales you want (en_US.UTF8)
Now:
# locale -a
C
C.UTF-8
en_US
en_US.iso88591
en_US.utf8
POSIX
1 2 3 4 5 6 7 |
# locale -a
C
C.UTF-8
en_US
en_US.iso88591
en_US.utf8
POSIX
|
You need to restart postgres:
# /usr/lib/postgresql/8.4/bin/pg_ctl restart -D /var/lib/postgresql/8.4/main
1 |
# /usr/lib/postgresql/8.4/bin/pg_ctl restart -D /var/lib/postgresql/8.4/main
|
Now rerun:
(postgres)-# create database "newdb" WITH ENCODING = 'UTF8' LC_CTYPE='en_US.utf8' LC_COLLATE='en_US.utf8' TEMPLATE template0;
1 |
(postgres)-# create database "newdb" WITH ENCODING = 'UTF8' LC_CTYPE='en_US.utf8' LC_COLLATE='en_US.utf8' TEMPLATE template0;
|