Bug report #10944

Spatialite layer - unable to change encoding - incorrect names display in Windows

Added by Jan Helebrant over 10 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Data Provider/SpatiaLite
Affected QGIS version:2.4.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:end of life
Crashes QGIS or corrupts data:No Copied to github as #:19297

Description

When I load Spatialite layer in QGIS the names are not displayed correctly. Used OSM data converted to Spatialite using OSGEO4W shell (saying "GDAL 1.11.0, released 2014/04/16") and following command:

C:\\GIS\\CZ_OSM_data_2014-07-22T20-21-02>ogr2ogr -f "SQLite" -dsco SPATIALITE=YES -spat 12.50004 50.46600 12.93001 50.15486 nejdek_OSM_2014_07.db czech-republic-latest.osm.pbf

Loaded the exported DB in QGIS and found out that the places labels are not displayed correctly in QGIS 2.4.0-Chugiak (GDAL/OGR 1.11.0, SpatiaLite 4.1.1) running on Windows 7 64bit while the same project is ok when opened in 2.4.0-Chugiak (GDAL/OGR 1.10.0, SpatiaLite 4.1.1) running on 32bit Kubuntu linux on my laptop. So the reason is default CP1250 encoding in Windows while the DB and Linux use UTF-8.

Cannot change encoding for Spatialite layer in GUI. The only solution currently is to manually edit the *.qgs project file in PSPad or Bluefish and replace:

<provider encoding="System">ogr</provider>

with:

<provider encoding="UTF-8">ogr</provider>

Would be nice to have this fixed :-)

thanks

History

#1 Updated by Giovanni Manghi over 10 years ago

  • Category changed from Data Provider/OGR to Data Provider/SpatiaLite

#2 Updated by Markus Straub over 10 years ago

I encountered the same problem when using one project with multiple platforms (Windows / Linux).

Would it be possible to avoid having encoding=System in the qgis project file at all? Imho all referenced resources in a qgis project won't change their encoding when used on another platform, but the default platform encoding will. So hardcoding the encoding seems to be a better choice for me.

#3 Updated by Andre Joost over 10 years ago

Giovanni, I think "OGR Data Provider" was correctly set. As I explained here: http://gis.stackexchange.com/questions/108132/incorrect-display-of-national-characters-from-spatialite-in-qgis-windows it makes a difference whether I open the datasource with "Add Vector Layer" or "Add Spatialite Layer". The second one writes into the .qgs file:

<provider encoding="System">spatialite</provider>

which is handled correctly (although "System" is still wrong, but spatialite is always utf-8 and the driver knows that).

It is the ogr driver that writes the wrong encoding into the project file, and uses it.

Anyway, I would appiciate having the "Encoding" field in the Properties, general tab enabled for all data types, not only shapefiles.

#4 Updated by Jan Helebrant over 10 years ago

Hi,
I used drag-n-drop to add the Spatialite dataset to QGIS - both in Windows and Linux. In that case it writes:

<provider encoding="System">ogr</provider>

in the QGS file.

#5 Updated by Giovanni Manghi over 7 years ago

  • Regression? set to No
  • Easy fix? set to No

#6 Updated by Giovanni Manghi over 5 years ago

  • Resolution set to end of life
  • Status changed from Open to Closed

Also available in: Atom PDF