Bug report #17288

QGIS3: OGR processing of scratch layers leads to wrong encoding

Added by Tobias Wendorff 11 months ago. Updated 7 months ago.

Assignee:Victor Olaya
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:worksforme
Crashes QGIS or corrupts data:No


I've created a point on a scratch layer and set this UTF-8 string to a text field:

Γαζέες καὶ μυρτιὲς δὲν θὰ βρῶ πιὰ στὸ χρυσαφὶ ξέφωτο
. That's greek for
No more shall I see acacias or myrtles in the golden clearing

After processing and loading the result, the text turned to

Ga??e? ?a? µ??t??? d?? ?? ß?? p?? st? ???saf? ??f?t?

As you can see in processing logs, the fileEncoding is wrong, since it is set to "System". Maybe it's better to use UTF-8:

{'OUTPUT': <QgsProcessingOutputLayerDefinition {'sink':C:/Users/test/AppData/Local/Temp/processing_b3eeb99e5a0c4e5f990f7c7b7d49a8d6/b637937656184ec4bffdd7608cce306a/OUTPUT.shp, 'createOptions': {'fileEncoding': 'System'}}>}


#1 Updated by Giovanni Manghi 11 months ago

  • Status changed from Open to Feedback

Does this also affects 2.18.13?

#2 Updated by Tobias Wendorff 11 months ago

Can't tell you. Seems like QGIS2 can't process scratch layers with OGR at all:

2017-10-16T13:15:43    2    Uncaught error while executing algorithm
            Traceback (most recent call last):
              File "C:/OSGEO4~1/apps/qgis-rel-dev/./python/plugins\processing\core\GeoAlgorithm.py", line 203, in execute
              File "C:/OSGEO4~1/apps/qgis-rel-dev/./python/plugins\processing\algs\gdal\GdalAlgorithm.py", line 52, in processAlgorithm
                commands = self.getConsoleCommands()
              File "C:/OSGEO4~1/apps/qgis-rel-dev/./python/plugins\processing\algs\gdal\ogr2ogrbuffer.py", line 79, in getConsoleCommands
                layername = "'" + ogrLayerName(inLayer) + "'" 
            TypeError: cannot concatenate 'str' and 'NoneType' objects

#3 Updated by Giovanni Manghi 7 months ago

  • Resolution set to worksforme
  • Status changed from Feedback to Closed

Just checked on the latest master and seems to be ok, please reopen of necessary.

Also available in: Atom PDF