From e0a64d3e3155f05f55bc71f4e7ef46507d431e19 Mon Sep 17 00:00:00 2001 From: Thiago Franco de Moraes Date: Thu, 17 Jan 2019 10:06:54 -0200 Subject: [PATCH] Fixed problem with invalid utf8 char in vtk text --- invesalius/data/vtk_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/invesalius/data/vtk_utils.py b/invesalius/data/vtk_utils.py index e69b449..8044f01 100644 --- a/invesalius/data/vtk_utils.py +++ b/invesalius/data/vtk_utils.py @@ -140,12 +140,12 @@ class Text(object): # UnicodeEncodeError because they have non-ascii characters. To avoid # that we encode in utf-8. if sys.platform == 'win32': - self.mapper.SetInput(value.encode("utf-8")) + self.mapper.SetInput(value.encode("utf-8", errors='replace')) else: try: self.mapper.SetInput(value.encode("latin-1")) except(UnicodeEncodeError): - self.mapper.SetInput(value.encode("utf-8")) + self.mapper.SetInput(value.encode("utf-8", errors='replace')) def SetCoilDistanceValue(self, value): if isinstance(value, int) or isinstance(value, float): -- libgit2 0.21.2