I combined two solutions from other sites that did the job (this answer works for Ubuntu server 12.04 and PGSQL 9.1):
-
Create a file:
nano /etc/profile.d/lang.sh
. -
Add the following:
export LANGUAGE="en_US.UTF-8" export LANG="en_US.UTF-8" export LC_ALL="en_US.UTF-8"
-
Save the file
-
Restart the shell or run all export commands manually in current shell instance
-
Reconfigure so the encoding can be UTF8 ([got it from here][1])
sudo su postgres psql update pg_database set datistemplate=false where datname="template1"; drop database Template1; create database template1 with owner=postgres encoding='UTF-8' lc_collate="en_US.utf8" lc_ctype="en_US.utf8" template template0; update pg_database set datistemplate=true where datname="template1";
-
Use template1 for db creation.