From 57a541ec7d52c8eb53fc923baefc04ecdb17c823 Mon Sep 17 00:00:00 2001 From: fdiaz Date: Mon, 5 Dec 2022 12:10:26 +0100 Subject: [PATCH] Fix encoding issues --- quickinfo.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/quickinfo.py b/quickinfo.py index ae9ceb9..e3fa8d3 100644 --- a/quickinfo.py +++ b/quickinfo.py @@ -55,7 +55,7 @@ def getTooltipValue(self, point, projection): trace('QuickInfo.getTooltipValue: %s point %s, no records selected return ""' % (repr(fieldName), point.convertToWKT()) ) return "" if mode == "useField": - return str(firstfeature.get(fieldName)) + return firstfeature.get(fieldName) # Eval expression with expression manager = ExpressionEvaluatorLocator.getManager() @@ -113,7 +113,10 @@ def point(self, event): p = event.getMapPoint() p = p.buffer(self.__tolerance).getEnvelope().getGeometry() tip = self.quickinfo.getTooltipValue(p,self.projection) - self.mapControl.setToolTipText(unicode(tip, 'utf-8')) + if isinstance(tip, unicode): + self.mapControl.setToolTipText(tip) + else : + self.mapControl.setToolTipText(unicode(tip, 'utf-8', 'ignore')) def main(*args): viewDoc = gvsig.currentView()