From 3dc0f7706537445957c5d8bb33826fd7376b1396 Mon Sep 17 00:00:00 2001 From: Patola Date: Sun, 25 Feb 2018 17:57:43 -0300 Subject: [PATCH] Better handle non-ascii characters This prevents the following error when using fcinfo as diff driver for WebTools Git: (...) File "/usr/local/bin/fcinfo", line 89, in startElement print (" " + key + " : " + val) UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 17: ordinal not in range(128) fatal: unable to read files to diff --- src/Tools/fcinfo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tools/fcinfo b/src/Tools/fcinfo index 3017955d29..4e1ae74823 100755 --- a/src/Tools/fcinfo +++ b/src/Tools/fcinfo @@ -86,7 +86,7 @@ class FreeCADFileHandler(xml.sax.ContentHandler): items = self.contents.items() items.sort() for key,val in items: - print (" " + key + " : " + val) + print (" " + key.encode("utf-8").strip() + " : " + val.encode("utf-8").strip()) self.contents = {} print (" Objects: ("+self.count+")")