Skip to content

Commit

Permalink
Merge pull request #7307 from rldhont/processing-r-enconde-string-218
Browse files Browse the repository at this point in the history
[Bugfix][Processing] R script: ParameterString has to be encoding
  • Loading branch information
m-kuhn committed Jun 25, 2018
2 parents 294f8ac + 70e0395 commit 87e93c1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion python/plugins/processing/algs/r/RAlgorithm.py
Expand Up @@ -27,6 +27,7 @@


import os import os
import json import json
import types


from qgis.PyQt.QtGui import QIcon from qgis.PyQt.QtGui import QIcon


Expand Down Expand Up @@ -499,12 +500,20 @@ def getImportCommands(self):
commands.append(param.name + '= NULL') commands.append(param.name + '= NULL')
else: else:
commands.append(param.name + ' = "' + param.value + '"') commands.append(param.name + ' = "' + param.value + '"')
elif isinstance(param, (ParameterTableField, ParameterTableMultipleField, ParameterString, elif isinstance(param, (ParameterTableField, ParameterTableMultipleField,
ParameterFile)): ParameterFile)):
if param.value is None: if param.value is None:
commands.append(param.name + '= NULL') commands.append(param.name + '= NULL')
else: else:
commands.append(param.name + '="' + param.value + '"') commands.append(param.name + '="' + param.value + '"')
elif isinstance(param, ParameterString):
if param.value is None:
commands.append(param.name + '= NULL')
elif type(param.value) == types.StringType:
commands.append(param.name + '="' + param.value + '"')
else:
c = unicode(param.name) + u'="' + unicode(param.value) + u'"'
commands.append(c.encode('utf8'))
elif isinstance(param, (ParameterNumber, ParameterSelection)): elif isinstance(param, (ParameterNumber, ParameterSelection)):
if param.value is None: if param.value is None:
commands.append(param.name + '= NULL') commands.append(param.name + '= NULL')
Expand Down

0 comments on commit 87e93c1

Please sign in to comment.