Skip to content
Permalink
Browse files

[Bugfix][Processing] R script: ParameterString has to be encoding

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 70e03951ba42eb910cf8618199b1cf765970cbff
Showing with 10 additions and 1 deletion.
  1. +10 −1 python/plugins/processing/algs/r/RAlgorithm.py
@@ -27,6 +27,7 @@

import os
import json
import types

from qgis.PyQt.QtGui import QIcon

@@ -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')

0 comments on commit 70e0395

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