From b7932e15ea1a8623e94f81ba29d91ae2ef456f01 Mon Sep 17 00:00:00 2001 From: lovetox Date: Fri, 30 Sep 2016 17:03:30 +0200 Subject: [PATCH] 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. --- src/common/connection_handlers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py index 5f32e1234..42c661829 100644 --- a/src/common/connection_handlers.py +++ b/src/common/connection_handlers.py @@ -332,7 +332,7 @@ class ConnectionVcard: 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 @@ class ConnectionVcard: 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: