Okay and thank you for your answers! Since using the '--config PGCLIENTENCODING format' option didn't make a difference, my next guess is that the encoding of the shapefile might be the problem. I have used SQL_ASCII, LATIN1, LATIN9, WIN1250, WIN1252 as formats and I still get the error. The formats has been selected according to my location (Denmark).
Do you have any suggestions to how I should proceed? -----Oprindelig meddelelse----- Fra: Even Rouault [mailto:even.roua...@mines-paris.org] Sendt: 4. september 2009 16:28 Til: Casper Børgesen Cc: gdal-dev@lists.osgeo.org Emne: Re: [gdal-dev] PostgreSQL, PostGIS and ogr2ogr Selon Casper Børgesen <c...@le34.dk>: I'm not sure about options='-c client_encoding=latin1', but setting PGCLIENTENCODING=LATIN1 instead as an environmnent variable/configuration option should definitely work (provided that the source shape is effectively LATIN1 encoded) ogr2ogr --config PGCLIENTENCODING LATIN1 -f PostgreSQL PG:"host=localhost user=username dbname=dbname password=password" sourcefile > 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 > > _______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev