From 06cc746378fa2d51fd7a2717c67c0c15ccf737b2 Mon Sep 17 00:00:00 2001 From: daid Date: Thu, 30 Aug 2012 18:03:42 +0200 Subject: [PATCH] Fixed #198 - This was a tricky one, because the project planner added an override in unicode, the start code was converted from utf-8 to unicode, and thus the getGlobalProfileString tried to store an unicode string, while it is designed to encode utf-8 encoded strings. Python3 should catch these issues better, but there is no wxPython for python3 yet. --- Cura/util/profile.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cura/util/profile.py b/Cura/util/profile.py index ab4f030..9b3f2a4 100644 --- a/Cura/util/profile.py +++ b/Cura/util/profile.py @@ -242,7 +242,7 @@ def getGlobalProfileString(): if globalProfileParser.has_section('profile'): for key in globalProfileParser.options('profile'): if key in tempOverride: - p.append(key + "=" + unicode(tempOverride[key])) + p.append(key + "=" + tempOverride[key]) tempDone.append(key) else: p.append(key + "=" + globalProfileParser.get('profile', key)) @@ -255,14 +255,14 @@ def getGlobalProfileString(): alt.append(key + "=" + globalProfileParser.get('alterations', key)) for key in tempOverride: if key not in tempDone: - p.append(key + "=" + unicode(tempOverride[key])) + p.append(key + "=" + tempOverride[key]) ret = '\b'.join(p) + '\f' + '\b'.join(alt) ret = base64.b64encode(zlib.compress(ret, 9)) return ret def getProfileSetting(name): if name in tempOverride: - return unicode(tempOverride[name]) + return unicode(tempOverride[name], "utf-8") #Check if we have a configuration file loaded, else load the default. if not globals().has_key('globalProfileParser'): loadGlobalProfile(getDefaultProfilePath()) @@ -362,7 +362,7 @@ def isPreference(name): ## Temp overrides for multi-extruder slicing and the project planner. tempOverride = {} def setTempOverride(name, value): - tempOverride[name] = value + tempOverride[name] = unicode(value).encode("utf-8") def resetTempOverride(): tempOverride.clear()