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.
This commit is contained in:
parent
d0ace18434
commit
b7932e15ea
1 changed files with 2 additions and 2 deletions
|
@ -332,7 +332,7 @@ class ConnectionVcard:
|
||||||
else:
|
else:
|
||||||
path_to_file = path
|
path_to_file = path
|
||||||
try:
|
try:
|
||||||
fil = open(path_to_file, 'w')
|
fil = open(path_to_file, 'w', encoding='utf-8')
|
||||||
fil.write(str(card))
|
fil.write(str(card))
|
||||||
fil.close()
|
fil.close()
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
|
@ -355,7 +355,7 @@ class ConnectionVcard:
|
||||||
if not os.path.isfile(path_to_file):
|
if not os.path.isfile(path_to_file):
|
||||||
return None
|
return None
|
||||||
# We have the vcard cached
|
# We have the vcard cached
|
||||||
f = open(path_to_file)
|
f = open(path_to_file, encoding='utf-8')
|
||||||
c = f.read()
|
c = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Reference in a new issue