I am using UTF8 as encoding for my Postgres 8.4.11 database:
CREATE DATABASE test
WITH OWNER = postgres
ENCODING = \'UTF8\'
TABLESPACE = myda
The key element is the client_encoding
- the encoding the server expects from your client. It has to match what is actually sent. What do you get for show client_encoding
? Is it UNICODE
?
Read more in the chapter Automatic Character Set Conversion Between Server and Client of the manual.
If you are using psql as client, you can set client_encoding
with \encoding
. Check the encoding your local system users (on Linux type locale
in the shell) and set a matching client_encoding
in psql. You can avoid such complications if you use the same locale on your system as you use as encoding
for your PostgreSQL server.
If you use puTTY (on Windows), make sure to set its "Translation" accordingly. Have a look at Settings: Window - Translation. Must match client_encoding
. You can right-click in a running session and chose Change Settings. You can also save these settings with your saved sessions.
I have "UTF-8" for puTTY on a Windows XP system, encoding
and client_encoding
all set to UNICODE
(= UTF8
in Postgres), works for me.