Bug report #5982

vector layer encoding default not saved not configurable

Added by Etienne Tourigny over 12 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Vectors
Affected QGIS version:master 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 #:15397

Description

Working with shapefiles with encoding that is not UTF-8 (say ISO-8859-1) is cumbersome because there is no way to automatically set the encoding to the proper value.

This could be accomplished by one of the following:

- saving the encoding chosen in the layer properties as a value in the .qml file for subsequent loading (in the General tab->Provider Specific->Encoding)
- project-wide default
- default in the user options


Related issues

Related to QGIS Application - Bug report #5911: Language Driver ID in dbf file of new shapefile Closed 2012-06-30

History

#1 Updated by Minoru Akagi over 12 years ago

The encoding of vector layer is stored in QGIS project file(*.qgs).

When QgsOpenVectorLayerDialog("Add vector layer"), QgsVectorLayerSaveAsDialog("Save vector layer as") or QgsEncodingFileDialog(such as "New Shapefile Layer") is shown, the name of last used encoding in the dialog boxes is selected as the value of encoding combo-box.

Perhaps you will open the vector layer files by drag-and-drop. In my case, a shapefile dataset without specified codepage opened by drag-and-drop, the encoding of the layer provider has been set to "System". If the encoding was set to the last used codepage as well, it might be easier to use.

Will a default be more preferable than the last used value?

#2 Updated by Etienne Tourigny over 12 years ago

In my case, I have seen this with shapefiles in ISO-8859-1 encoding and no cpg file.

When I open the file in qgis (via commandline or from the browser dock), the encoding is set to System, and if I go and set the encoding to ISO-8859-1 it is fine. If I click "save default", a .qml file is generated but without any encoding information. So when I close qgis and re-open the file, System encoding is seleceted again and I have to re-set the encoding.

GDAL 1.9 does not recognize the encoding, I have to set SHAPE_ENCODING=ISO-8859-1 or else accented characters are garbled. When SHAPE_ENCODING is set before starting qgis, then the encoding is fine. I will try with latest ogr (from svn trunk) and see if that fixes.

I don't think that "last encoding" should be used (because it might not be ok for the next file), but rather encoding should be stored inside the .qml file (in addition or instead of .qps file). A specific file encoding does not pertain to a project but to a file. Say you would have many files but with different encodings in the same project, or you would have the same file in different projects.

#3 Updated by Jürgen Fischer over 10 years ago

  • Target version changed from Version 2.0.0 to Future Release - Lower Priority

#4 Updated by Giovanni Manghi over 7 years ago

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

#5 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