0

I have table raw_ca_dd

When upload data into the table I get an error like:

invalid byte sequence for encoding "UTF8": 0xfb
\copy raw_ca_dd from 'dbo_CA_list.csv.dak' with delimiter ','  csv quote as '"'

I unable to find this error. Help?

Craig Ringer
  • 307,061
  • 76
  • 688
  • 778
user2793872
  • 299
  • 1
  • 5
  • 14
  • possible duplicate of [invalid byte sequence for encoding "UTF8"](http://stackoverflow.com/questions/4867272/invalid-byte-sequence-for-encoding-utf8) – Daniel Vérité Jan 02 '14 at 12:20

1 Answers1

3

I'd say your file is in a different encoding, like iso-8859-15, rather than utf-8, since 0xfb is invalid utf-8, but is û in many of the ISO 8859 encodings. It could also be , ϋ, ű, ћ, ū in various other ISO 8859 encodings. There are also a bunch of code-pages (eg cp1255) I didn't bother to check.

Find out what the correct encoding of your file is and specify it with the encoding parameter to the copy command, eg:

\copy raw_ca_dd from 'dbo_CA_list.csv.dak' with encoding 'iso-8859-1' delimiter ','  csv quote as '"' 

Don't assume it's iso-8850-15. Find out the actual text encoding of the input file and use that.

Craig Ringer
  • 307,061
  • 76
  • 688
  • 778