From dbc7fe9c6747d97aa97ef9720139eb1a62767511 Mon Sep 17 00:00:00 2001 From: Markus Hovorka Date: Sat, 10 Feb 2018 11:34:22 +0100 Subject: [PATCH] FEM: fix unicode conversion error (sifio.py) The sifio module could only serialize the str type. This commits adds support for unicode strings. Some properties of FreeCAD objects like the equation variable name use unicode strings. --- src/Mod/Fem/femsolver/elmer/sifio.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Mod/Fem/femsolver/elmer/sifio.py b/src/Mod/Fem/femsolver/elmer/sifio.py index bd2ae98b39..28d615a7b8 100644 --- a/src/Mod/Fem/femsolver/elmer/sifio.py +++ b/src/Mod/Fem/femsolver/elmer/sifio.py @@ -394,12 +394,14 @@ class _Writer(object): return _TYPE_REAL if issubclass(dataType, str): return _TYPE_STRING + if issubclass(dataType, unicode): + return _TYPE_STRING raise ValueError("Unsupported data type: %s" % dataType) def _preprocess(self, data, dataType): if issubclass(dataType, Section): return str(self._idMgr.getId(data)) - if issubclass(dataType, str): + if issubclass(dataType, str) or issubclass(dataType, unicode): return '"%s"' % data return str(data)