qgis - error of data conversion value getting while importing shapefile in shp2pgsql-gui on ubuntu

Connecting: host=localhost port=5432 user=postgres dbname=tremblement_de_terre Connection succeeded. Connecting: host=localhost port=5432 user=postgres dbname=tremblement_de_terre

============================== Importing with configuration: m_cap point, public, geom, /home/jean/Documents/M_CAP Point.shp, mode=c, dump=1, simple=1, geography=0, index=1, shape=1, srid=0 Shapefile type: MultiPoint PostGIS type: POINT[2] Unable to convert data value to UTF-8 (iconv reports "Chaîne multi-octets ou étendue de caractères invalide ou incomplète"). Current encoding is "UTF-8". Try "LATIN1" (Western European), or one of the values described at http://www.postgresql.org/docs/current/static/multibyte.html.

Shapefile import failed.

After trying to know the encode setting with the ubuntu shell command file -f .shp,the result is something like

file -f M_CAP\ Point.shp : ERROR: cannot open ' (No such file or directory) : ERROR: cannot open' (No such file or directory) : ERROR: cannot open ' (No such file or directory) ��OA�\���?A�: ERROR: cannot open��OA�\���?A�' (No such file or directory) ��OA: ERROR: cannot open ��OA' (No such file or directory) ��OA: ERROR: cannot open��OA' (No such file or directory) �5A�X=�: ERROR: cannot open �5A�X=�' (No such file or directory) �5A�X=�: ERROR: cannot open�5A�X=�' (No such file or directory) �5A�X=�: ERROR: cannot open �5A�X=�' (No such file or directory) ��XCAp���_A~�: ERROR: cannot open��XCAp���_A~�' (No such file or directory)


When I also try to open this file with QGis as a Vector layer, using UTF-8 encoding, It opens clearly. What happens now when trying to import it to postgres using shp2pgsql-gui?

Please help me, the original file have been created on windows, and I am using Ubuntu 12.04 Lts. Thanks a lot

1 Answer

  1. Luke- Reply

    2019-11-15

    When importing the shapefile by means of the gui interface press in "Options" and in "DBF file character encoding" set "LATIN1" as suggested by the error message.

    If your dbf is in another encoding that LATIN1, set the correct one instead of this. If you are on windows probably it would be "CP1250"

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>