changeset cd9664c9b166 in /home/hg/repos/gajim
author: lovetox forenjunkie@chelo.at branches: details:http://hg.gajim.org/gajim?cmd=changeset;node=cd9664c9b166 description: Use UTF-8 to store VCards
If we dont specify the encoding, the system default is used which leads to encoding/decoding errors, depending on what the actual system default encoding is.
diffstat:
src/common/connection_handlers.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diffs (21 lines):
diff -r e84eafcc8630 -r cd9664c9b166 src/common/connection_handlers.py --- a/src/common/connection_handlers.py Sun Sep 18 15:18:30 2016 +0200 +++ b/src/common/connection_handlers.py Fri Sep 30 17:03:30 2016 +0200 @@ -332,7 +332,7 @@ else: path_to_file = path try: - fil = open(path_to_file, 'w') + fil = open(path_to_file, 'w', encoding='utf-8') fil.write(str(card)) fil.close() except IOError as e: @@ -355,7 +355,7 @@ if not os.path.isfile(path_to_file): return None # We have the vcard cached - f = open(path_to_file) + f = open(path_to_file, encoding='utf-8') c = f.read() f.close() try: