summaryrefslogtreecommitdiff
path: root/grc
diff options
context:
space:
mode:
Diffstat (limited to 'grc')
-rw-r--r--grc/gui/VariableEditor.py3
-rw-r--r--grc/gui/canvas/param.py6
2 files changed, 9 insertions, 0 deletions
diff --git a/grc/gui/VariableEditor.py b/grc/gui/VariableEditor.py
index b243829197..d815e5ddd1 100644
--- a/grc/gui/VariableEditor.py
+++ b/grc/gui/VariableEditor.py
@@ -183,6 +183,9 @@ class VariableEditor(Gtk.VBox):
# Evaluate the params
for key in block.params:
evaluated = str(block.params[key].evaluate())
+ # ensure that evaluated is a UTF-8 string
+ # Old PMTs could produce non-UTF-8 strings
+ evaluated = evaluated.encode('utf-8', 'backslashreplace').decode('utf-8')
self.set_tooltip_text(evaluated)
# Evaluate the block value
diff --git a/grc/gui/canvas/param.py b/grc/gui/canvas/param.py
index 92d1f84941..3480d79618 100644
--- a/grc/gui/canvas/param.py
+++ b/grc/gui/canvas/param.py
@@ -73,6 +73,9 @@ class Param(CoreParam):
if hasattr(value, "__len__"):
tooltip_lines.append('Length: {}'.format(len(value)))
value = str(value)
+ # ensure that value is a UTF-8 string
+ # Old PMTs could produce non-UTF-8 strings
+ value = value.encode('utf-8', 'backslashreplace').decode('utf-8')
if len(value) > 100:
value = '{}...{}'.format(value[:50], value[-50:])
tooltip_lines.append('Value: ' + value)
@@ -139,6 +142,9 @@ class Param(CoreParam):
else:
# Other types
dt_str = str(e)
+ # ensure that value is a UTF-8 string
+ # Old PMTs could produce non-UTF-8 strings
+ dt_str = dt_str.encode('utf-8', 'backslashreplace').decode('utf-8')
# Done
return _truncate(dt_str, truncate)