I had a problem the other day when I found out that my Postgres databases were set up with ASCII and I wanted UTF8. After much fishing around for answers I was helped out by the kind people on the mailing listhttp://archives.postgresql.org/pgsql-general/….
First, you need to back up anything in the PGDATA directory, as it will get trashed. Then you can run
initdb with the correct switches - I chose to set the local to British, and to get it to prompt for the superuser password. Your data directory probably isn’t in the same place as mine, as I tend to install stuff to /Library/Frameworks/ since I’m on a mac (and that’s what you should be doing if you’re on a mac, but most people ignore this;)
initdb --encoding=UTF8 --locale=en_GB -D /Library/Frameworks/Postgresql.framework/Data --pwprompt
And now you have UTF8! Using the template1 database as the template for your new databases (which is the default anyway) you’ll get these settings.