Changed file encoding to UTF-8

This commit is contained in:
Samer Afach 2018-03-27 23:01:45 +02:00
parent 0942b4d12a
commit 7b6aeaec36

View File

@ -31,7 +31,7 @@ def write_keys_to_file(auth_keys, password, file_name="data.dat"):
if os.path.exists(file_name):
os.rename(file_name, backup_file)
with open(file_name, 'wb') as f:
f.write(encrypt_data(auth_keys.dump_data().encode(), password, _salt))
f.write(encrypt_data(auth_keys.dump_data().encode('utf-8'), password, _salt))
if os.path.exists(backup_file):
os.remove(backup_file)
@ -41,7 +41,7 @@ def read_keys_from_file(password, file_name="data.dat"):
ciphered_data = f.read()
readable_data = decrypt_data(ciphered_data, password, _salt)
keys_object = AuthenticatorKeys()
keys_object.read_dump(readable_data.decode())
keys_object.read_dump(readable_data.decode('utf-8'))
return keys_object