Error:
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.
Solution:
1) Edit the dump.sql file
vi dump.sql
2) Change the line
SET client_encoding = ‘SQL_ASCII’;
to
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.
Tags: byte sequence does not match the encoding, dump and restore a postgres database, how to change client_encoding?, how to dump a pgsql database?, how to restore a pgsql database?, invalid byte sequence for encoding "UTF8", pgsql database + utf8 encoding error, pgsql database and client_encoding, UTF8 encoding error while restoring pgsql database
