[gdal-dev] What's up with the 8859 encoding?

Roger André randre at gmail.com
Fri Nov 7 15:10:42 PST 2014


I see.  So the output will default to ISO-8859-1 - regardless of the input
.CPG - if the ENCODING flag isn't used.

On Fri, Nov 7, 2014 at 3:08 PM, Even Rouault <even.rouault at spatialys.com>
wrote:

> Le samedi 08 novembre 2014 00:03:22, Roger André a écrit :
> > Even,
> >
> > Thank you for the quick reply.   And it appears that using a .CPG file
> does
> > not make a difference in this.  Is that correct?
>
> You have to realize that the input and output side of ogr2ogr are
> completely
> isolated from each other.
>
> So if your input shapefile has a .cpg,  the shapefile driver will use it to
> recode from the input dbf encoding mentionned in the .cpf to UTF-8 which is
> the pivot encoding of OGR (if the .cpg indicates UTF-8 then no recoding
> occurs)
> If the output is a shapefile and you specify -lco ENCODING=UTF-8, as the
> pivot
> encoding of OGR is UTF-8, no recoding will occur and an output .cpg file
> indicating UTF-8 will be generated.
>
> >
> > Roger
> >
> > On Fri, Nov 7, 2014 at 3:00 PM, Even Rouault <even.rouault at spatialys.com
> >
> >
> > wrote:
> > > Le vendredi 07 novembre 2014 23:53:09, Roger André a écrit :
> > > > Hello List,
> > > >
> > > > I am very curious why after installing GDAL 1.11, I now need to use
> the
> > > > -lco ENCODING=UTF-8 option when using ogr2ogr on any of my already
> > > > UTF-8 encoded shapefiles?  Failure to do so results in this error,
> > > >
> > > > Warning 1: One or several characters couldn't be converted correctly
> > > > from UTF-8 to ISO-8859-1.
> > >
> > > Roger,
> > >
> > > The default encoding of shapefiles is ISO-8859-1. So if you don't
> specify
> > > -lco
> > > ENCODING=UTF-8, the shapefile driver will attempt to recode from UTF-8
> to
> > > ISO-8859-1. This behaviour has been introduced in GDAL 1.9. Previously
> no
> > > transcoding was done, and there could be mismatch between the actual
> > > encoding
> > > of the content and the declared encoding of the DBF.
> > >
> > > Even
> > >
> > > --
> > > Spatialys - Geospatial professional services
> > > http://www.spatialys.com
>
> --
> Spatialys - Geospatial professional services
> http://www.spatialys.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20141107/c17f2e71/attachment-0001.html>


More information about the gdal-dev mailing list