10

When I'm dissolving a shapefile:

ogr2ogr "b:\out.shp" "b:\Tele.shp" -dialect sqlite -sql "SELECT ST_Union(geometry), nev, jar FROM Tele GROUP BY jar" 

I got error message like:

Warning 1: One or several characters couldn't be converted correctly from UTF-8 to ISO-8859-1.

I don't understand this because Tele.cpg contains "UTF-8"

When trying this:

ogr2ogr "b:\out.shp" "b:\Tele.shp" -dialect sqlite -sql "SELECT ST_Union(geometry), nev, jar FROM Tele GROUP BY jar" ENCODING=UTF-8

the error message is:

Warning 1: layer names ignored in combination with -sql. ERROR 1: Failed to create field name 'nev' : cannot convert to "UTF-8"

So what should I do to keep my strange Hungarian characters?

9

Type -lco before the ENCODING=UTF-8 part, a.k.a -lco ENCODING=UTF-8 and it should work (it did for me and my strange Polish characters).

  • It creates a .cpg file along side the .shp file, and in QGIS I noticed I still have to change the encoding from 'System' to 'UTF-8' in the properties for the attribute table to display characters correctly. – Sylvia H Jul 13 '17 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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