Skip to content

Commit

Permalink
[Bugfix][Processing] R script: ParameterString has to be encoding
Browse files Browse the repository at this point in the history
In Processing R script, each parameter is inserted in the script by rewriting
the file. So it's necessary to encode ParameterString to correctly write the
processing r script.
  • Loading branch information
rldhont committed Jun 22, 2018
1 parent 294f8ac commit 70e0395
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 json
import types

from qgis.PyQt.QtGui import QIcon

Expand Down Expand Up @@ -499,12 +500,20 @@ def getImportCommands(self):
commands.append(param.name + '= NULL')
else:
commands.append(param.name + ' = "' + param.value + '"')
elif isinstance(param, (ParameterTableField, ParameterTableMultipleField, ParameterString,
elif isinstance(param, (ParameterTableField, ParameterTableMultipleField,
ParameterFile)):
if param.value is None:
commands.append(param.name + '= NULL')
else:
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)):
if param.value is None:
commands.append(param.name + '= NULL')
Expand Down

0 comments on commit 70e0395

Please sign in to comment.