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

Peter Hopfgartner peter.hopfgartner at r3-gis.com
Fri Feb 26 05:55:56 PST 2010


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 




More information about the postgis-users mailing list