Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a database and exporting with pgsql2shp various shapefiles. But when I open the dbf the characters are displayed wrong. Example: BroeksterwÔld and this should be Broeksterwäld.

This probably has to do with encoding. The database is UTF-8. I tried to export the shapefiles as LATIN1, but I can't figure out how to do so.

Hope someone can help me.


UPDATE

I solved this problem by adding 'set pgclientencoding=latin1' (without quotes) to the batch script.

share|improve this question

3 Answers 3

There's the option -W for pgsql2shp that allows you to specify the encoding. You could also look into setting the PGCLIENTENCODING environment variable. Most data sets from either the Dutch CBS or the Dutch Kadaster come in the CP1252 encoding, not Latin1.

share|improve this answer
    
Thanks! I believe the -W option only works from shp 2 postgres and unfortunately not from postgres 2 shp. I tried to set the PGCLIENTENCODING environment variable, but I am not sure if I do it correctly. What do I need to set, would that by system variables and then under variable 'PGCLIENTENCODING' (without quotes) and under value 'Latin1' or 'CP1252' (without quotes). And how do I write the pgsql2shp command then. Like this: pgsql2shp.exe -f folder -h .. -p .. -u ... -P .. -g geometrie .., or do I need to add something. Thanks for your help! –  Stefan Aug 13 '12 at 7:14
up vote 2 down vote accepted

I solved this problem by adding 'set pgclientencoding=latin1' (without quotes) to the batch script.

share|improve this answer

Which s/w are you using to view the shapefile?. If you use QGIS, it will allow you to select the encoding of the shapefile, and you can then save it with the new encoding. See also here

share|improve this answer
    
Thanks for the answer. But I would like to put the encoding in a script I have. Because there are 60 shapefile exports every month. I don't want to manually change the encoding every month for every file. Do you perhaps know a way to put it in a script. –  Stefan Aug 9 '12 at 14:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.