[gdal-dev] Codepage trouble with ogr2ogr from csv into Spatialite

Even Rouault even.rouault at mines-paris.org
Wed Sep 7 14:02:49 EDT 2011


Le mercredi 07 septembre 2011 18:34:14, Jukka Rahkonen a écrit :
> I tried to convert data from text file into Spatialite through VRT file.
> Everything goes otherwise OK but the non-ASCII characters in the original
> text do not convert correctly. I am on Windows and the text file is using
> Windows Latin 1 encoding. I haven't found a place to give codepage in any
> of the VTR, CSV, or SQLite drivers. Is there any other way to get the
> characters right than convert CSV first into shapefiles  and use
> Spatialite tools for importing them finally into Spatialite?

UTF-8 is considered as being the pivot encoding, so I don't see any choice 
than using shapefiles for doing recoding. Perhaps we could have an option in 
ogr2ogr to do user-specified recoding on the fly, for example -s_encoding -
t_encoding parameters ...

If you use GDAL trunk, you could set the SHAPE_ENCODING configuration option of 
the shapefile driver to an empty string, so as no recoding occurs. 

ogr2ogr out.shp in.vrt --config SHAPE_ENCODING ""

When reading out.shp, OGR will transcode from the default shapefile encoding, 
which it interprets as being Latin1, to the OGR pivot encoding which is UTF-8, 
which is probably what expects Spatialite.

> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list