diff options
author | Damir Jelić <poljar@termina.org.uk> | 2019-06-18 13:46:57 +0200 |
---|---|---|
committer | Damir Jelić <poljar@termina.org.uk> | 2019-06-18 13:50:46 +0200 |
commit | 2f5590bf38e5995a36f770c04cfbf31eb9070eca (patch) | |
tree | 299e68cd3b9ea33f212cd1a7c4fcf0bbbca4bfc8 /python/olm/sas.py | |
parent | e1a4e6ebf1568935a57ba8cec48e43dd7c1ebcd3 (diff) |
olm: Allow decryption functions to define how to handle unicode decode errors.
This patch changes the decryption functions not to fail if there was an
unicode decode error while converting the decrypted bytes plaintext into
a native python string.
Characters that cannot be decoded as unicode are now replaced with the
unicode replacement character (U+FFFD).
The old behaviour of raising an UnicodeDecodeError can be achieved by
passing the "strict" error handling scheme to the decrypt function.
Diffstat (limited to 'python/olm/sas.py')
-rw-r--r-- | python/olm/sas.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/python/olm/sas.py b/python/olm/sas.py index c12b7bc..bea1dd0 100644 --- a/python/olm/sas.py +++ b/python/olm/sas.py @@ -30,15 +30,15 @@ Examples: """ -from functools import wraps from builtins import bytes +from functools import wraps from typing import Optional from future.utils import bytes_to_native_str from _libolm import ffi, lib -from ._compat import URANDOM, to_bytes, to_bytearray +from ._compat import URANDOM, to_bytearray, to_bytes from ._finalize import track_for_finalization |