qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.35k stars 2.98k forks source link

QGIS3: OGR processing of scratch layers leads to wrong encoding #25186

Closed qgib closed 6 years ago

qgib commented 6 years ago

Author Name: Tobias Wendorff (Tobias Wendorff) Original Redmine Issue: 17288 Affected QGIS version: master Redmine category:processing/ogr Assignee: Victor Olaya


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'}}>}
qgib commented 6 years ago

Author Name: Giovanni Manghi (@gioman)


Does this also affects 2.18.13?


qgib commented 6 years ago

Author Name: Tobias Wendorff (Tobias Wendorff)


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
                self.processAlgorithm(progress)
              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
qgib commented 6 years ago

Author Name: Giovanni Manghi (@gioman)


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