2

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 Answers 2

5

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;
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for reply. This also didn't work. Actually when i execute insert query from query browser(pgAdmin4) then it executed successfully but when I execute the same command from batch script (Command line) then it gives me the error. So shall I have to set anything in batch script? Word: ** e.g. patiënt **
Yes, you have to include the SET statement in the batch script. Depending on which client you are using, there may be more elegant ways of setting the client encoding, but the SET statement is the fool-proof way.
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.