[Qgis-user] Shapefile with file .cpg(codepage)

Even Rouault even.rouault at spatialys.com
Thu Jul 7 03:58:10 PDT 2016


Le jeudi 07 juillet 2016 12:16:17, Andrea Peri a écrit :
> Hi,
> I have some shapefiles with an extra file having extension .cpg.
> The .cpg extension is a optional extension for declaration of Code-Page.
> Is this file knowed and supported from QGIS 2.14. ?
> 
> I don't know if the qgis when loading a shapefile is using the ogr or
> instead is using an own shapefile provider, but however I don't know
> if gdal is knowing and using this .cpg file.

Andrea,

OGR does use the .cpg file when present (I'm just updating 
http://gdal.org/drv_shapefile.html since it only mentions the reading of the 
codepage byte in the DBF header, but the .cpg presence overrides that) and 
QGIS uses OGR to read shapefiles.

But, in QGIS, the default behaviour is to make OGR *not* use the encoding 
detected by the OGR shapefile driver and use instead the user defined encoding 
in the GUI. Unless you go to Settings / Options / Data Sources and uncheck the 
"Ignore shapefile encoding declaration", in which case OGR will manage the 
transcoding itself.

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com



More information about the Qgis-user mailing list