geek175
geek175

Reputation: 137

psql on windows: ERROR: invalid byte sequence for encoding "UTF8": 0xc8 0x20

on database1:

but set "PGPASSWORD=password1" & set "PGCLIENTENCODING=UTF8" & psql.exe -h 127.0.0.1 -p 5432 -U postgres -d database1 -c "INSERT INTO table1 (column1) VALUES ('mise à jour 1');"

shows: ERROR: invalid byte sequence for encoding "UTF8": 0xc8 0x20

the error disappears if PGCLIENTENCODING is set to ISO_8859_5 for example

how to fix this issue?

Upvotes: 0

Views: 484

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 247865

There is nothing much to fix. Your Windows shell uses a different encoding than UTF-8, so you have to set the client encoding to that encoding to make it work. To find out which client encoding to use, you must figure out which encoding your shell uses. That in turn depends on which shell you are using and how the Windows system was configured.

Upvotes: 2

Related Questions