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
This commit is contained in:
@@ -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+")")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user