View Ticket
Not logged in
Ticket Hash: 050cb1d7966f3aa6feef80b2ef3f0cd8606ea359
Title: UTF-8 encoding fail in dbf while using ImportSHP() SQL function
Status: Closed Type: Code_Defect
Severity: Important Priority: Immediate
Subsystem: Resolution: Overcome_By_Events
Last Modified: 2016-04-06 11:37:07
Version Found In: 4.3.0a
User Comments:
anonymous added on 2016-03-22 16:29:37:
Hello,

first let me say: Thanks for all the work on Spatialite!

I was trying to import a Shapefile using the SQL query:
    "SELECT ImportSHP('C:/somePath/test', 'import', 'UTF-8', 31465, 'the_geom', 'PrimaryKey');"
The Shapefile was created with QGIS ("UTF-8" encoding) and has special characters e.g. "äÄöÖüÜß" in the attribute names and in the values of the attributes.
I recieved following error message:
    load shapefile error: cannot open shapefile 'C:/somePath/test'
        cause: 'C:/somePath/test.dbf' field name: invalid character sequence

The Same error appears in the spatialite_gui, when I tried importing the Shapefile in "UTF-8" encoding.
When I tried to import the Shapefile with
    "SELECT ImportSHP('C:/somePath/test', 'import', 'CP1252', 31465, 'the_geom', 'PrimaryKey');"
the import works but the special characters are garbeled.
When I checked the dbf database of the Shapefile it was encoded in "UTF-8".
I could provide an example Shapefile if necessary.

Greetings from Germany

sandro added on 2016-04-06 11:37:07:
the current development version (4.4.0-devel) already fixed in recent times many issues caused by inconsitent charset conversions when importing/exporting SHP and DBF files.