Skip to content

Commit

Permalink
Better handle non-ascii characters
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Patola authored and yorikvanhavre committed Feb 26, 2018
1 parent 0038120 commit 3dc0f77
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Tools/fcinfo
Original file line number Diff line number Diff line change
Expand Up @@ -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+")")

Expand Down

0 comments on commit 3dc0f77

Please sign in to comment.