[postgis-users] Postgis to ESRI shape file encoding problem

Armin Burger armin.burger at gmx.net
Sat Jul 19 04:08:34 PDT 2008

If I remember well pgsql2shp creates a shapefile with the same encoding
(applied on the dbf file of it) as the database. The problem is that
clients may have problems with this encoding.

It's possible to export UTF-8 PG tables to shapefile which then also is
UTF-8 encoded. This is correctly read e.g. by Mapserver, but not for
most other clients I know (also not Opensource ones like JUMP, gvSig,
etc). For Albanian I would guess that ISO-8859-1 (Latin1) will not be
the right encoding, more something like ISO-8859-2 (Latin2).

If you database is in UTF-8 you should be able to export to a shapefile
with Latin2 encoding by converting the single columns to Latin2 with
specifying the SQL select command in pgsql2shp

pgsql2shp yourdatabase "select the_geom, convert(field1, 'UTF8',
'LATIN2'), field2 from ..."

If then your client program can interpret Latin2 correctly, which most
should be able to, you're done.


On 18/07/2008 11:00, Ervin Ramonllari wrote:
> Hello everybody,
> I'm trying to export some data from a Postgresql database encoded in 
> UTF-8 into some ESRI shape files.
> I'm using PostGIS Dumper (pgsql2shp).
> the export is done correctly, but some special characters could not be 
> exported properly. I guess it's a problem of encoding but I can't figure 
> out how to deal with it.
> I googled around but couldn't find something useful.
> Any help for solving my problem would be highly appreciated,
> thanks in advance,
> Ervin.
> ------------------------------------------------------------------------
> Explore the seven wonders of the world Learn more! 
> <http://search.msn.com/results.aspx?q=7+wonders+world&mkt=en-US&form=QBRE>
> ------------------------------------------------------------------------
> _______________________________________________
> 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