[postgis-users] Read file encoding from from shape file

Paul Ramsey pramsey at opengeo.org
Fri Feb 26 06:00:38 PST 2010


I was never certain that ESRI software actually respected the DBF code
page flags, but your reference indicates they do, so this seems
reasonable. Some investigation of the current state of shapelib WRT
encoding would be wise, as I think we should update our shapelib to
the current version when we release 2.0.

P.

On Fri, Feb 26, 2010 at 5:55 AM, Peter Hopfgartner
<peter.hopfgartner at r3-gis.com> wrote:
> Hi
>
> Looking into the sources of shp2pgsql, [0], it seems that the loader assumes
> that the encoding of the dbf file is  "WINDOWS-1252", if not specified
> differently by the -W command line option.
>
> From [1], shape files carry some information about their encoding, either in
> the dbf file header at byte position 29, [2], or in a separate file with
> extension CPG.
>
> Would it make sense to change the default behaviour of shp2pgsql into:
>
> 1) try to get file encoding from dbf file or cpg file
> 2) if 1) fails, take WINDOWS-1252 as default
> 3) if -W is given, take this option
>
> And then, is the information about the encoding set by pgsql2shp? It would
> be smooth, if shapes generated by pgsql2shp could be imported by shp2pgsql
> without specifying any encoding during import ("just works").
>
> Regards,
>
> Peter
>
> [0] http://trac.osgeo.org/postgis/browser/trunk/loader/
> [1]
> http://support.esri.com/index.cfm?fa=knowledgebase.techArticles.articleShow&d=21106
> [2] http://www.dbase.com/knowledgebase/int/db7_file_fmt.htm
>
> --
>
> Dott. Peter Hopfgartner
>
> R3 GIS Srl - GmbH
> Via Johann Kravogl-Str. 2
> I-39012 Meran/Merano (BZ)
> Email: peter.hopfgartner at r3-gis.com
> Tel. : +39 0473 494949
> Fax  : +39 0473 069902
> www  : http://www.r3-gis.com
>
> XING : http://www.xing.com/go/invita/8917535
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>



More information about the postgis-users mailing list