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??
asked Sep 10, 2013 at 5:34
-
This PostgreSQL question is explained on the help page (look for ENCODING). It has has nothing to do with PostGIS.Mike T– Mike T2013年09月10日 08:50:20 +00:00Commented 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 problemblueman010112– blueman0101122013年09月10日 09:10:37 +00:00Commented Sep 10, 2013 at 9:10
1 Answer 1
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
answered Sep 12, 2013 at 21:12
lang-sql