-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problems decoding content #77
Comments
I confirm the issue. I have an example where there is an encoding error: The e-mail is correctly parsed when I change the line: This problem is probably the duplicate of #64.
@martinrusev What do you think about it? Interested by a pull-request? By the way, I think the |
@sblondon |
I checked the erroneous message with the latest imbox version from the repository and I can't reproduce the error. So I will not send a pull-request until I get a new error. @cvlli If you still have errors, could you provide a file example? If you have login access to the IMAP server, the file is probably is ~/Maildir/cur (or tmp). The goal is to add another test case to fix the issue and avoid encoding error in the future. |
has most probably been fixed by #96 and can be closed |
And #78 |
Similar decoding error in 0.9.5
|
@wesinator can you provide the header which produce the bug? |
@sblondon No, unfortunately I lost that specific one, it got deleted. But if I see it again I'll try to provide a header. |
ok, thanks @wesinator |
Traceback (most recent call last): File "/root/PycharmProjects/Teste/main.py", line 26, in <module> next_message = next(all_messages) File "/usr/local/lib/python3.5/dist-packages/imbox/__init__.py", line 50, in fetch_list yield (uid, self.fetch_by_uid(uid)) File "/usr/local/lib/python3.5/dist-packages/imbox/__init__.py", line 41, in fetch_by_uid email_object = parse_email(raw_email) File "/usr/local/lib/python3.5/dist-packages/imbox/parser.py", line 151, in parse_email content = decode_content(part) File "/usr/local/lib/python3.5/dist-packages/imbox/parser.py", line 119, in decode_content return content.decode(charset) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa9 in position 906: invalid start byte
Some emails can have content encoded with Latin-1, Latin-15 or something else.
May add:
`
import chardet
...
def _decode_content(message):
targetEncoding = "utf-8"
`
The text was updated successfully, but these errors were encountered: