# HG changeset patch # User Paul Boddie # Date 1446576546 -3600 # Node ID 47610f1b9ad0caa508e3a1b8db16c439b2305b5e # Parent edb0b214e523003dd473607417522e8e14964983 Handle Unicode from the Web interface when setting preferences. diff -r edb0b214e523 -r 47610f1b9ad0 imiptools/profile.py --- a/imiptools/profile.py Tue Nov 03 18:51:25 2015 +0100 +++ b/imiptools/profile.py Tue Nov 03 19:49:06 2015 +0100 @@ -24,6 +24,7 @@ from imiptools.filesys import fix_permissions, FileBase from os.path import exists, isdir from os import listdir, makedirs +import codecs import pytz def identity_dict(l): @@ -191,7 +192,7 @@ if not filename or not exists(filename): raise KeyError, name - f = open(filename) + f = codecs.open(filename, encoding="utf-8") try: return f.read().strip() finally: @@ -205,7 +206,7 @@ if not filename: return False - f = open(filename, "w") + f = codecs.open(filename, "w", encoding="utf-8") try: f.write(value) finally: