Bug report #1494

for shapefiles: save/load of project has two problems with character encoding

Added by Steven Mizuno about 15 years ago. Updated over 14 years ago.

Assignee:Magnus Homann
Category:Data Provider
Affected QGIS version: Regression?:No
Operating System:All Easy fix?:No
Pull Request or Patch supplied: Resolution:worksforme
Crashes QGIS or corrupts data: Copied to github as #:11554


For shapefiles (OGR), on project save and load, there are two problems:

1. no encoding information is saved to the project file. Therefore, the shapefile may be opened with an incorrect encoding on loading a project.

I guessed (and found in the reading code) that a tag called <encoding> might be used, so I hand edited a project file to include this. Now the shapefile can be opened with the correct encoding.

2. if a column name having i18n characters is used as the label field, that column does not appear as the label field on project load, even with the encoding info in the project file. Names without i18n characters do appear. I did find the column name in the project file, so it seems to be written out ok.

Further, saving and loading a style file does get the column name as the label.

I was using files with UTF-8 encoding, but I believe the problems will occur with other encodings.


#1 Updated by artfwo - about 15 years ago

Confirming. The same happens with 1.1 as well.

#2 Updated by Magnus Homann over 14 years ago

  • Status changed from Open to In Progress

#3 Updated by Magnus Homann over 14 years ago

  • Resolution set to worksforme
  • Status changed from In Progress to Closed

Tested with .

1) Encoding seems to be written to .qgs file now. Changing encoding with editor in the .qgs file (e.g. from utf.-8 to utf-16) does make the words unreadable.

2) Labels with i18n characters in field name does appear after re-loading project. I also re-loaded on win xp, and the i18n characters are as specified (utf-8).

Tested with a shapefile created from QGIS.

If you still think there's an error, please reopen.

Also available in: Atom PDF