Skip to content

Python unicode decode errors when decrypting.

poljar requested to merge python/unicode_decode_errors into master

This patch-set implements the ability to let the library handle Unicode decode errors when decrypting a ciphertext that contains non-Unicode bytes.

Up until now decrypting such an ciphertext would raise a UnicodeDecodeError, to let users chose how they would handle such errors every decrypt function received a "unicode_errors" argument where library users can pick an error handling scheme as defined by the codecs module. The default error handling scheme is "replace" where characters that fail to decode are replaced with the unicode replacement character (U+FFFD)

  • The first patch adds a new to_native_str() function which handles the bytes -> str conversion.
  • The second patch replaces the bytes_to_native_str() function with the new to_native_str() function.
  • The third patch just adds an isort target to the Makefile.

Merge request reports