[postgis-users] Modify encoding of shapefile

Arnaud Lesauvage arnaud.lesauvage at supermail.fr
Tue May 29 03:48:07 PDT 2007


Nicolas Ribot a écrit :
>> Hi list !
>>
>> I had to export a bunch of data from postgis to shapefile (using pgsql2shp), but unfortunately I did this without changing my client-encoding.
>> The destination application does not like the shapefiles the way they are, and all special characters are unreadable ("Ã(c)" instead of "é" for instance).
>> The export was quite painfull (a lot of time and some manual work), and I was wondering whether there would be a simple way to import the shapefiles into postgis, and then re-export them with the correct encoding (LATIN1, AFAICT) ?
>>
>> Thanks for any hint on this !
>>
> 
> Iconv may help, I think, converting shapefile encoding into target db encoding:
> 
> shp2pgsql -dDI TRONCON_ROUTE.SHP troncon_route | iconv -f LATIN1 -t
> UTF-8 | psql routing
> 
> as seen on David techer's pgRouting tutorial
> (http://www.davidgis.fr/documentation/win32/html/apa.html)

Thanks a lot Nicolas, that did the trick !
I just had to do the opposite of course (iconv -f UTF-8 -t LATIN1).
I am on Windows, so I had to install gnuwin32 to work with a windows-compiled version of iconv. I recommend this et of linux tools to anyone working on windows !

Thanks again !



More information about the postgis-users mailing list