martes, 14 de julio de 2009

shp2pgsql UTF-8 enconding workaround

While trying to convert a shapefile and load it to a DB, some latin characters on the data were a problem and the parameter that shp2pgsql provides for the encoding did not work

shp2pgsql -W "UTF-8" ... :(

Then, a nice workaround is to use | with iconv:
shp2pgsql  file.shp  schema.table | iconv -f LATIN1 -t UTF-8 | psql

1 comentario: