Commit e0a64d3e3155f05f55bc71f4e7ef46507d431e19
1 parent
685ff1d7
Exists in
master
Fixed problem with invalid utf8 char in vtk text
Showing
1 changed file
with
2 additions
and
2 deletions
Show diff stats
invesalius/data/vtk_utils.py
| @@ -140,12 +140,12 @@ class Text(object): | @@ -140,12 +140,12 @@ class Text(object): | ||
| 140 | # UnicodeEncodeError because they have non-ascii characters. To avoid | 140 | # UnicodeEncodeError because they have non-ascii characters. To avoid |
| 141 | # that we encode in utf-8. | 141 | # that we encode in utf-8. |
| 142 | if sys.platform == 'win32': | 142 | if sys.platform == 'win32': |
| 143 | - self.mapper.SetInput(value.encode("utf-8")) | 143 | + self.mapper.SetInput(value.encode("utf-8", errors='replace')) |
| 144 | else: | 144 | else: |
| 145 | try: | 145 | try: |
| 146 | self.mapper.SetInput(value.encode("latin-1")) | 146 | self.mapper.SetInput(value.encode("latin-1")) |
| 147 | except(UnicodeEncodeError): | 147 | except(UnicodeEncodeError): |
| 148 | - self.mapper.SetInput(value.encode("utf-8")) | 148 | + self.mapper.SetInput(value.encode("utf-8", errors='replace')) |
| 149 | 149 | ||
| 150 | def SetCoilDistanceValue(self, value): | 150 | def SetCoilDistanceValue(self, value): |
| 151 | if isinstance(value, int) or isinstance(value, float): | 151 | if isinstance(value, int) or isinstance(value, float): |