Skip to content
Permalink
Browse files

[processing] fixed handling of input filenames with non-ascii characters

Looks like there is no problem now in SAGA when using filenames with non-ascii chars, so some code used for replacing filenames has been removed. Also some code for python2, which is not needed now.

fixes #18617
  • Loading branch information
volaya committed Jan 24, 2019
1 parent e3516ab commit fda41e3b0202041e681b2f69568f2a6dc2bb69e3
@@ -396,12 +396,6 @@ def exportRasterLayer(self, parameterName, layer):
else:
filename = os.path.basename(layer.source())

validChars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:'
filename = ''.join(c for c in filename if c in validChars)

if len(filename) == 0:
filename = 'layer'

destFilename = QgsProcessingUtils.generateTempFilename(filename + '.sgrd')
sessionExportedLayers[layer.source()] = destFilename
self.exportedLayers[parameterName] = destFilename
@@ -97,7 +97,7 @@ def sagaDescriptionPath():

def createSagaBatchJobFileFromSagaCommands(commands):

with open(sagaBatchJobFilename(), 'w') as fout:
with open(sagaBatchJobFilename(), 'w', encoding="utf8") as fout:
if isWindows():
fout.write('set SAGA=' + sagaPath() + '\n')
fout.write('set SAGA_MLB=' + os.path.join(sagaPath(), 'modules') + '\n')
@@ -108,12 +108,7 @@ def createSagaBatchJobFileFromSagaCommands(commands):
else:
pass
for command in commands:
try:
# Python 2
fout.write('saga_cmd ' + command.encode('utf8') + '\n')
except TypeError:
# Python 3
fout.write('saga_cmd ' + command + '\n')
fout.write('saga_cmd ' + command + '\n')

fout.write('exit')

0 comments on commit fda41e3

Please sign in to comment.
You can’t perform that action at this time.