From 48113f3bca3e75e867702c5521a440f3307f3b85 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Sat, 6 Jun 2015 12:52:44 -0300 Subject: [PATCH] Arch: Fixed encoding in IFC import - fixes #2149 --- src/Mod/Arch/importIFC.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Mod/Arch/importIFC.py b/src/Mod/Arch/importIFC.py index f5f84a311ebe..916be361fd52 100644 --- a/src/Mod/Arch/importIFC.py +++ b/src/Mod/Arch/importIFC.py @@ -388,7 +388,9 @@ def insert(filename,docname,skip=[],only=[],root=None): guid = product.GlobalId ptype = product.is_a() if DEBUG: print count,"/",len(products)," creating object ",pid," : ",ptype, - name = product.Name or str(ptype[3:]) + name = str(ptype[3:]) + if product.Name: + name = product.Name.decode("unicode_escape").encode("utf8") if PREFIX_NUMBERS: name = "ID" + str(pid) + " " + name obj = None baseobj = None @@ -514,7 +516,7 @@ def insert(filename,docname,skip=[],only=[],root=None): for p in properties[pid]: o = ifcfile[p] if o.is_a("IfcPropertySingleValue"): - a[o.Name] = str(o.NominalValue) + a[o.Name.decode("unicode_escape").encode("utf8")] = str(o.NominalValue) obj.IfcAttributes = a # color @@ -601,7 +603,8 @@ def insert(filename,docname,skip=[],only=[],root=None): if aid in skip: continue # user given id skip list if "IfcAnnotation" in SKIP: continue # preferences-set type skip list name = "Annotation" - if annotation.Name: name = annotation.Name + if annotation.Name: + name = annotation.Name.decode("unicode_escape").encode("utf8") if PREFIX_NUMBERS: name = "ID" + str(aid) + " " + name shapes2d = [] for repres in annotation.Representation.Representations: @@ -622,7 +625,9 @@ def insert(filename,docname,skip=[],only=[],root=None): fcmats = {} for material in materials: - name = material.Name or "Material" + name = "Material" + if material.Name: + name = material.Name.decode("unicode_escape").encode("utf8") if MERGE_MATERIALS and (name in fcmats.keys()): mat = fcmats[name] else: