Browse Source

encode globale parameters before replacing it in brain loader. Closes #239

nico 8 năm trước cách đây
mục cha
commit
3834ab7cdc
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  1. 3 1
      kalliope/core/ConfigurationManager/BrainLoader.py

+ 3 - 1
kalliope/core/ConfigurationManager/BrainLoader.py

@@ -287,6 +287,8 @@ class BrainLoader(object):
             if param_no_brackets in settings.variables:
                 logger.debug("Replacing variable %s with  %s" % (param_with_bracket,
                                                                  settings.variables[param_no_brackets]))
+                # need to encode utf-8 to handle special characters
+                unicode_str = settings.variables[param_no_brackets].encode('utf-8')
                 sentence_no_spaces = sentence_no_spaces.replace(param_with_bracket,
-                                                                str(settings.variables[param_no_brackets]))
+                                                                unicode_str)
         return sentence_no_spaces