[gdal-dev] Ogr2ogr from Spatialite into PostGIS stops to non-ASCII character [SOLVED]

Jukka Rahkonen jukka.rahkonen at mmmtike.fi
Fri Jun 15 00:45:07 PDT 2012


Jeff McKenna <jmckenna <at> gatewaygeomatics.com> writes:

> 
> On 12-06-13 10:46 AM, Jukka Rahkonen wrote:
> > 
> > Next trouble: I would now take the data back from PostGIS into Spatialite (it
> > was much faster to do some processing with PostGIS) but the happens again: my
> > non-ascii characters are converted to something invalid. I cannot see any
> > SQLITECLIENTENCODING option or anything.
> > 
> 
> It is difficult for me to comment without testing.  I would guess that
> you need to use the "-sql" ogr2ogr switch with something like this
> command for sqlite: http://www.sqlite.org/pragma.html#pragma_encoding
> 
> -jeff

This appeared to be an garbage in, garbage out case. I had made my initial
import from LATIN1 encoded shapefiles into Spatialite without setting
SHAPE_ENCODING first. That lead to wrong encoding used inside Spatialite. It
seemed that translating this carbage into PostGIS was successful after I set the
 PGCLIENTENCODING to LATIN1 but apparently it did not lead to totally correct
result with my data.
I started everything again by setting SHAPE_ENCODING before doing the initial
shapefiles to Spatialite conversion and then my characters seem to remain
correct in the following steps.

These character encoding things are a bit messy. Sometimes conversions go well
without any encoding settings but sometimes not and then there are driver
specific config options like SHAPE_ENCODING and PGCLIENTENCODING and
DXF_ENCODING and some other ways are needed when working with GML or Mapinfo
files. I would remember better the usage of some switch like
-SOURCE_ENCODING=xxx if it was common for all the drivers.

-Jukka Rahkonen- 




More information about the gdal-dev mailing list