Use utf-8 to save preferences, so the last filename may contain unicode characters.
This commit is contained in:
parent
96d014b2c4
commit
b7701af448
1 changed files with 2 additions and 2 deletions
|
@ -158,7 +158,7 @@ def getPreference(name):
|
||||||
globalPreferenceParser.set('preference', name, str(default))
|
globalPreferenceParser.set('preference', name, str(default))
|
||||||
print name + " not found in preferences, so using default: " + str(default)
|
print name + " not found in preferences, so using default: " + str(default)
|
||||||
return default
|
return default
|
||||||
return globalPreferenceParser.get('preference', name)
|
return unicode(globalPreferenceParser.get('preference', name), "utf-8")
|
||||||
|
|
||||||
def putPreference(name, value):
|
def putPreference(name, value):
|
||||||
#Check if we have a configuration file loaded, else load the default.
|
#Check if we have a configuration file loaded, else load the default.
|
||||||
|
@ -168,7 +168,7 @@ def putPreference(name, value):
|
||||||
globalPreferenceParser.read(getPreferencePath())
|
globalPreferenceParser.read(getPreferencePath())
|
||||||
if not globalPreferenceParser.has_section('preference'):
|
if not globalPreferenceParser.has_section('preference'):
|
||||||
globalPreferenceParser.add_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'))
|
globalPreferenceParser.write(open(getPreferencePath(), 'w'))
|
||||||
|
|
||||||
#########################################################
|
#########################################################
|
||||||
|
|
Loading…
Reference in a new issue