[gdal-dev] PostgreSQL, PostGIS and ogr2ogr

Casper Børgesen cbo at le34.dk
Fri Sep 4 08:22:04 EDT 2009


Hi folks!

I hope you can help me. I have searched google for answers, but haven't found any. So I thought going closer to the 'source' might help me.

In my organisation, we work with various GIS data in different file formats. I have a project, where I need to put all these data into a PostGIS database. So far I'm using the command line tool ogr2ogr to inject the data. But I have problems with character encoding:

ERROR 1: INSERT command for new feature failed.
ERROR: invalid byte sequence for encoding "UTF8": 0xf8
HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding". 

My PostGIS database uses UTF-8 and the data I'm working with (shape) is probably Latin1 encoded. 

I found a discussion where a user suggests that the solution might be to do the following:

ogr2ogr -f PostgreSQL PG:"host=localhost user=username dbname=dbname password=password options='-c client_encoding=latin1'" sourcefile;

It does not seem to affect the injection. So, what am I doing wrong?

Kind regards, Casper

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20090904/dd6f2a4f/attachment-0001.html


More information about the gdal-dev mailing list