I would like to change my server_encoding which is currently SQL_ASCII to UTF8.
I have existing data that I would like to keep.
From my understanding of the steps I need to:
1) alter the template1 database encoding via
UPDATE pg_database SET encoding = 6 where datname IN ('template0', 'template1');
2) Dump my current database
pg_dump -Fc foo > foo.db
3) Drop my current database
drop database foo;
4) recreate it with the proper encoding
create database foo with template = template1 encoding = 'UTF-8';
5) restore from backup
pg_restore -d foo foo.db
Are these the correct steps to perform or is there an easier / in-place way?
Also, when I dump my old DB and restore it, will it be converted appropriately (e.g. it came from am SQL_ASCII encoding
andits going into a UTF-8 database)?
Thank you
/Cody