Skip to content

Commit

Permalink
Draft: Used replace strategy in latin1 encodings - issue #853
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed May 17, 2014
1 parent 293930b commit da4f1bd
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Mod/Draft/Draft.py
Expand Up @@ -3217,9 +3217,9 @@ def updateData(self, obj, prop):
if coin.COIN_MAJOR_VERSION >= 4:
self.string = obj.ViewObject.Override.encode("utf8").replace("$dim",self.string)
else:
self.string = obj.ViewObject.Override.encode("utf8").replace("$dim",self.string).decode("latin1")
self.string = obj.ViewObject.Override.encode("utf8").replace("$dim",self.string).decode("latin1","replace")
except:
self.string = obj.ViewObject.Override.encode("utf8").replace("$dim",self.string).decode("latin1")
self.string = obj.ViewObject.Override.encode("utf8").replace("$dim",self.string).decode("latin1","replace")
self.text.string = self.text3d.string = self.string

# set the distance property
Expand Down Expand Up @@ -3497,7 +3497,14 @@ def updateData(self, obj, prop):
else:
self.string = DraftGui.displayExternal(a,getParam("dimPrecision",2),'Angle',su)
if obj.ViewObject.Override:
self.string = obj.ViewObject.Override.decode("utf8").encode("latin1").replace("$dim",self.string)
try:
from pivy import coin
if coin.COIN_MAJOR_VERSION >= 4:
self.string = obj.ViewObject.Override.encode("utf8").replace("$dim",self.string)
else:
self.string = obj.ViewObject.Override.encode("utf8").replace("$dim",self.string).decode("latin1","replace")
except:
self.string = obj.ViewObject.Override.encode("utf8").replace("$dim",self.string).decode("latin1","replace")
self.text.string = self.text3d.string = self.string

# check display mode
Expand Down

0 comments on commit da4f1bd

Please sign in to comment.