I have Googled a lot but failed to find the answer.

My configuration is:

  • Ubuntu 11.10
  • Quantum GIS - 1.9.0-Master 'Master' (caae7b7)
  • GDAL 1.9.2, released 2012/10/08

Shapefiles refuse to open in correct encoding. I have some of them in CP1251 encoding. It seems that the problem is already solved. http://trac.osgeo.org/gdal/ticket/4650

I have the latest GDAL library and nothing helps.

Can anyone tell me how to debug GDAL? How can I understand if GDAL handles shapefile correctly (in terms of encoding)?

  • Did you try to encode the shapefile with qgis using layer -> save as (then selecting the proper encoding)? – U2ros Oct 23 '12 at 13:01
  • Yes, I did. No luck. – Vladimir Oct 23 '12 at 13:08

There is something fundamentally wrong with GDAL's shapefile encoding detection feature. In latest QGIS 1.9 builds, you can ignore GDAL's shapefile encoding by going into the Options window and checking the [ ] Ignore shapefile encoding. You can then set the correct encoding in the layer property window.

See http://hub.qgis.org/projects/quantum-gis/repository/revisions/75dc85b4d652116814873bb7674cab15ce6cde66 and its related issues for more background.

  • Thanks nirvn! That solved my problem! I will post the solution to other places where I have asked. – Vladimir Oct 23 '12 at 13:41
  • The key is to set the correct encoding in the layer property window. Thanks! – ʞᴉɯ Jul 4 '14 at 7:29

You can set -lco ENCODING=UTF-8 (or 1251) as parameter in GDAL ogr2ogr, or enter it in the layer option field inside qgis when saving.

  • I am particularly interested in opening shp-files with correct encoding. Your advise didn't help, I tried it with my data. '?????' instead of text. – Vladimir Oct 23 '12 at 13:06

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.