0

I was trying to transfer data to my PostgreSQL database with the command

psql -h localhost -U postgres -d test -f C:\file.sql

but it gives me an error like

EROR: character with byte sequence 0x9e in encoding "WIN1254" has no equivalent in encoding "UTF8"

How can I solve this problem?. I used Windows 10 and Postgres version 12

jarlh
  • 42,561
  • 8
  • 45
  • 63
ADAM
  • 63
  • 1
  • 1
  • 6
  • That's appropriate, 0x9e has [no assigned character](https://en.wikipedia.org/wiki/Windows-1254#Character_set). Use chcp to select the correct code page: https://stackoverflow.com/questions/19162055/psql-shell-uses-code-page-850-windows-uses-1252-how-to-solve-change-console-co – Hans Passant Dec 07 '22 at 21:22

1 Answers1

1

You'll have to figure out what the encoding of the file is. Let's assume it is UTF-8. Then you can start your cmd.exe and type:

set PGCLIENTENCODING=UTF8

psql -h localhost -U postgres -d test -f C:\file.sql
Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263