[postgis-users] Shp2pgsql : unable to convert french UTF8 encoded shapefiles

Michael Fuhr mike at fuhr.org
Mon Feb 4 07:27:45 PST 2008


On Mon, Feb 04, 2008 at 10:29:17AM +0100, Alexandre Gacon wrote:
> I am trying to load several shapefiles provided by TéléAtlas in a postgis
> database with shp2pgsql on Windows XP and I have several problems.
> 
> The shapefiles contains the data for France and are encoded in UTF8.

Are you certain the data is UTF-8?  Have you verified by looking
at a hex dump?  Might some or all of it be in another encoding?

> If I generates pgsql files without indicating the encoding to use, shp2pgsql
> works fine but I can't execute the file with psql : I got an error about an
> "Illegal byte sequence". If I open a pgsql file with the pgAdmin tool, I
> manage to execute the sql request and it works fine.

What does "SHOW client_encoding" return in pgAdmin?

> This solution helps me but it is not enough : I can't do this for large
> shapefiles (the pgAdmin tool can not open the file) and I have several
> hundreds of files to load.
> 
> If I try to generate the pgsql file with the -W "UTF8" option, I got the
> same error than the psql command : "utf8 : Illegal byte sequence".

Do you have a small shapefile you could make available for others
to test with?  What are the exact shp2pgsql and psql commands you're
using?

-- 
Michael Fuhr



More information about the postgis-users mailing list