I am answering this because nothing from StackOverFlow worked for me.
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 it
Restart 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.
I hope this helps ;)
DROP DATABASE merch_telegram_bot_db;
CREATE DATABASE merch_telegram_bot_db ENCODING 'UTF8';
pg_restore -h localhost -p 5432 -U postgres -d merch_telegram_bot_db -v "/usr/local/bin/bot/test.backup"