4

I set my shapefiles UTF-8 encoding which supposed to display Arabic fine, but it doesn't work in QGIS unless I change the encoding to Windows-1256. QGIS reads the arabic well with this encoding.

But when I publish to Geoserver using the plugin or by uploading the shapefile and specify the exact same encoding or connected via Postgre it doesn't work in layer preview or GeoExplorer or when I add the WMS into ArcGIS, for example.

Does anyone have any recommendations for eastern languages encoding especially arabic? Why is this happening while it should work fine?

4

What I do in cases like this is change the encoding in the dbf file (part of the shapefile collection). This can be done with LibreOffice, for example. First make a backup copy of the original shapefile - all components. Then you open the dbf with LibreOffice, and specify Windows-1256 encoding. Then save back, but using UTF-8 encoding. Now when you open the shapefile in QGIS, you should see the labels OK, without setting any special encoding. Then when you upload to the web, labels should appear properly.

I mention LibreOffice because 1)it's FOSS and 2)I think that new versions of MS Excel do not read *.dbf any longer. And the process for defining the output encoding is somewhat complicated.

If the attribute table became empty, then go back to the original *.dbf, try to open/ save and close without making any changes. And then check with QGIS.

And an additional comment: when you load/save a shapefile in QGIS there's an option to select the encoding. You mentioned that you change the encoding to WINDOWS-1256 when you read the shapefile. In a similar way you can save to a new shapeifle with "Save As..." and select UTF-8 encoding in the save dialog. Then use this new shapefile in Geoserver. This is probably the easiest.

2
  • is LibreOffice something specific ? i tried to do that with excel and did what you said but in Qgis the attribute table was empty – Ibrahim Mohammed Sep 13 '16 at 21:36
  • I added some edits to the answer above – Micha Sep 16 '16 at 13:12

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.