Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to move a PostgreSql database from 8.3 Windows to 8.4 running on Linux (Ubuntu Server 12.04).

The restore aparently is ok, but when I try to show data in my program I get an error saying that some characters are not supported on WIN1252 encoding.

The original database has this properties:

Encoding: WIN1252 LC_CTYPE: English_United States.1252 LC_COLLATE: English_United States.1252

I can restore the database using LC_CTYPE = "C" and LC_COLLATE = "C", this way I get the unsupported characters in my program.

If I try to create the database using this command:

createdb -h \
--encoding=WIN1252 \
--lc-ctype='English_United States.1252' \
--lc-collate='English_United States.1252' \
-T template0  -U postgres mydb

I get this error:

createdb: falló la creación de la base de datos:
ERROR:  el nombre de configuración regional «English_United States.1252» no es válido

First of all, how can I let my O.S. include this regional configuration?.

share|improve this question
up vote 1 down vote accepted

The Windows-1252 character set is known in Ubuntu by its other name CP1252.

Generally no corresponding locale is installed by default on Ubuntu because Unix folks prefer iso-8859-15 or utf-8.

However the charmap should be provided by the locales packages. Assuming this package is installed, you may issue a command like this to create the relevant locale:

sudo localedef -f CP1252 \ 
               -i /usr/share/i18n/locales/en_US \

Then run sudo /etc/init.d/postgresql restart for postgres to pick up the new locale, avoiding Postgresql 9.2 “invalid locale name” on Ubuntu 12.04.

Then you should be able to run createdb like you did in the question except for the locale name which is en_US.CP1252 instead of the Windows-ish English_United States.1252

share|improve this answer
Thanks Daniel, that allowed me to create the database without issues. Now I have a new problem:… – Leonardo Ramé Sep 29 '13 at 10:05

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.