I’m receiving emails with the Google App Engine Python and storing those in the datastore.
class LogSenderHandler(InboundMailHandler):
def receive(self, mail_message):
logging.info("Received a message from: " + mail_message.sender)
When I receive an email from an ASCII address, everything works fine:
Me [me@gmail.com] is stored as Me [me@gmail.com]
However, if the sender values contains non-ascii chars, the data value stored looks like this:
Mr Kröber [mr.kroeber@gmail.com] is stored as =?ISO-8859-1?Q?Mr_Kr=F6ber?= [mr.kroeber@gmail.com]
The subject is encoded according to RFC 2047. See the Internationalized headers section of the email module.
Here is an example decoding the subject to Unicode: