Lost-Photos-Found
Lost-Photos-Found copied to clipboard
Support python 3.x
Working on that again after a few years. The real problem are changes in unicode handling and str vs bytes -- this is mostly done, but we still need to retrieve encoding from parts (i.e. we need to parse headers in raw data).
To make things worse, we can't always trust encoding claims, sometimes they fail:
ENCODING: utf-8
Traceback (most recent call last):
File "./lpf.py", line 40, in <module>
imap.lostphotosfound()
File "Lost-Photos-Found/lostphotosfound/server.py", line 274, in lostphotosfound
header_subject = _charset_decoder(mail['Subject'])
File "Lost-Photos-Found/lostphotosfound/utils.py", line 52, in _charset_decoder
header = header[0][0].decode(header[0][1])
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe0 in position 77: invalid continuation byte
You may want to have a look at my repo, branch port_to_python3
. It's a WIP of what I have so far, but some of the str/bytes and encoding solutions are ugly, ideally we should refactor to handle these in a single place.