[GIS] og2ogr character encoding problem

encodeogr2ogrutf-8

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?

Best Answer

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).

Related Question