[Solved] Ascii character in material name

A forum to discuss the implementation of a good Materials system in FreeCAD
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
schupin
Posts: 476
Joined: Sun Jan 21, 2018 1:43 pm

[Solved] Ascii character in material name

Post by schupin »

Hi,

I find a little bug in the material editor while naming a material with a special character (é)

Code: Select all

Traceback (most recent call last):
  File "/Applications/FreeCAD.app/Contents/Mod/Material/MaterialEditor.py", line 336, in savefile
    name = str(self.widget.Editor.findItems(translate("Material", "Name"), QtCore.Qt.MatchRecursive, 0)[0].text(1))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 4: ordinal not in range(128)
I guess there is a unicode(txt).encode('UTF8') to write somewhere ?

Or inserting

Code: Select all

import sys
reload(sys)
sys.setdefaultencoding('utf8')
at the begining of the file ?
Last edited by schupin on Sat Nov 24, 2018 4:22 pm, edited 1 time in total.
User avatar
yorik
Founder
Posts: 13660
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Ascii character in material name

Post by yorik »

This should now be fixed in git commit 652e1dbdd
schupin
Posts: 476
Joined: Sun Jan 21, 2018 1:43 pm

Re: Ascii character in material name

Post by schupin »

Works nice.
Thanks !
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Ascii character in material name

Post by Kunda1 »

Please mark this topic [Solved]
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Post Reply