DIscover the character encoding used by a Postgres database

Postgres has a single character encoding per database. It can also silently translate from different client encodings to the one configured for the server. So Postgres is pretty flexible and can handle most text you throw at it.

But, if you ever need or want to know, it's simple to discover what encoding is being used by the server.

$ psql
Welcome to psql 8.3.1, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

testdb=# show server_encoding;
 server_encoding
-----------------
 UTF8
(1 row)

Seeing what encoding is in use by your client is just as easy.

testdb=# show client_encoding;
 client_encoding
-----------------
 UTF8
(1 row)

http://www.postgresql.org/docs/8.3/static/multibyte.html

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.