0

I want to import csv into PostGIS database,

I receive error massage:

alpha=# COPY project FROM '/home/alpha/database/project.csv' DELIMITERS ',' CSV;
ERROR:  invalid byte sequence for encoding "UTF8": 0xc1da
CONTEXT:  COPY project, line 1

so I find my csv's coding is ISO-8859-1 and set encoding = ISO_8859_1

#SET client_encoding = ISO_8859_1;

COPY worked

but I use

SELECT * FROM project

it's give me a lot of garbled words!

so how to make it right??

2
  • This PostgreSQL question is explained on the help page (look for ENCODING). It has has nothing to do with PostGIS.
    – Mike T
    Sep 10, 2013 at 8:50
  • @Mike I can import csv into table but it shows lots of garbled in my data,not just import problem Sep 10, 2013 at 9:10

1 Answer 1

3

In my script, I begin with the statement: SET client_encoding = LATIN1; Then COPY table FROM 'D:\folder\file.csv' DELIMITERS ';' CSV HEADER;

Hope this can help

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.