1

I am facing issue while copying a file which is delimited by §. The database version is 9.1

File content are as below:

a§b§c
1§4§5

Copy command:

copy test.test_ingestion (a,b,c) from 'b.csv' CSV HEADER DELIMITER as E'§';

Error : invalid byte sequence for encoding "UTF8": 0xa7

As per my understanding § is a UTF-8 character and encoding of database is set to UTF-8. So why is it failing to copy file delimited by §.

Daniel Vérité
  • 58,074
  • 15
  • 129
  • 156

1 Answers1

0

0xa7 is the code for § in iso-latin-1 so obviously the data stream passed to COPY is encoded in iso-latin-1 rather than UTF-8.

As a solution, you can either set client_encoding to LATIN1 in the SQL session importing the contents or convert them to UTF-8 before import.

Daniel Vérité
  • 58,074
  • 15
  • 129
  • 156