1
votes

I am working on PostgreSQL and getting below error during insert statement execution from batch script(command line).

ERROR: invalid byte sequence for encoding "UTF8": 0xeb 0x6e 0x74

I have checked client_encoding by show client_encoding command and it is showing UTF-8.

Also checked database properties by using command

select * from pg_database where datname='<mydbName>'

In Output:

datcollate = English_United States.1252 datctype = English_United States.1252

How to resolve this issue?

2

2 Answers

4
votes

If the three bytes quoted by the error message are supposed to encode the string “ënt”, you can solve your problem by setting the correct client encoding, e.g.

SET client_encoding = WIN1252;
0
votes

This happened because you have special characteres in the name of the columns. Rename and delete special characters change the encoding for win-1252 and will work.