From: daid Date: Wed, 4 Apr 2012 09:10:08 +0000 (+0200) Subject: Use utf-8 to save preferences, so the last filename may contain unicode characters. X-Git-Tag: RC1~1 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=b7701af448f676f049fbccf80c5cc5597fb7a93f;p=cura.git Use utf-8 to save preferences, so the last filename may contain unicode characters. --- diff --git a/Cura/util/profile.py b/Cura/util/profile.py index 5845e14c..213c57a5 100644 --- a/Cura/util/profile.py +++ b/Cura/util/profile.py @@ -158,7 +158,7 @@ def getPreference(name): globalPreferenceParser.set('preference', name, str(default)) print name + " not found in preferences, so using default: " + str(default) return default - return globalPreferenceParser.get('preference', name) + return unicode(globalPreferenceParser.get('preference', name), "utf-8") def putPreference(name, value): #Check if we have a configuration file loaded, else load the default. @@ -168,7 +168,7 @@ def putPreference(name, value): globalPreferenceParser.read(getPreferencePath()) if not globalPreferenceParser.has_section('preference'): globalPreferenceParser.add_section('preference') - globalPreferenceParser.set('preference', name, str(value)) + globalPreferenceParser.set('preference', name, str(value).encode("utf-8")) globalPreferenceParser.write(open(getPreferencePath(), 'w')) #########################################################