isislovecruft / python-gnupg

A modified version of python-gnupg, including security patches, extensive documentation, and extra features.
Other
424 stars 172 forks source link

MIME encoding note #219

Open e3rd opened 6 years ago

e3rd commented 6 years ago

Since codecs library are seriously changed when iniciating GPG object and concerning issue remains closed I think it's worth noting this workaround. It would save me fifteen hours because it was very difficult to find such a bug – an independent iniciation changing whole Python behaviour.

jannschu commented 5 years ago

Indeed, the current workaround leads to very serious bugs. I spent many hours searching for a bug related to sending binary email attachments. Consider the following example:

'\udcff'.encode()  # raises Exception
from pretty_bad_protocol import gnupg
gpg = gnupg.GPG()
'\udcff'.encode()  # returns b'?'

The base 64 encoding in Python's email library relies on that exception! Please put this big notice in the README that this library breaks emails and significantly modifies unicode handling.