root@host [~]#  psql databasename < dump.sql

ERROR:  invalid byte sequence for encoding “UTF8″: 0xd1e9
HINT:  This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by “client_encoding”.

The above error is received while restoring a pgsql dump and when the clicnt_encoding of the database is mismatched.


1) Edit the dump.sql file

vi dump.sql

2) Change the line

SET client_encoding = ‘SQL_ASCII’;


SET client_encoding = ‘latin-1′;

i.e. you need to change the client_encoding from ‘SQL_ASCII’ to ‘latin-1′.

3) Save the file and restore the database once again.