OfflineIMAP / offlineimap

Read/sync your IMAP mailboxes (python2) [LEGACY: move to offlineimap3]
http://www.offlineimap.org
Other
1.78k stars 363 forks source link

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xea in position 1308: invalid continuation byte #690

Closed pprw closed 3 years ago

pprw commented 3 years ago

I have an error UnicodeDecodeError: 'utf-8' codec can't decode byte 0xea in position 1308: invalid continuation byte when launching offlineimap. It is related to few emails which contains for some reason (which one?) special character encoding.

How can I deal with it? If a global solution is not possible, how can I know which emails are concerned?

jishac commented 3 years ago

I would look at the discussion here: https://github.com/OfflineIMAP/offlineimap3/issues/43

If an email contains an encoding that is not us-ascii or utf-8 you will experience this issue. I first noticed it in offlineimap3 with my local mail generated by mutt. Mutt by default will use iso-8859-1 before utf-8, which causes this issue. So as a workaround for local generated messages setting this in your muttrc would be a workaround set send_charset = "us-ascii:utf-8"

It does not fully negate the issue.

You may also want to try offlineimap3 which patches the issue.

pprw commented 3 years ago

Thanks.

It seems to be fixed in Debian with the upgrade from 7.3.3+dfsg1-1+0.0~git20210218.76c7a72+dfsg-1 to 7.3.3+dfsg1-1+0.0~git20210225.1e7ef9e+dfsg-3. At least I don't have the error anymore (and I didn't delete the emails concerned.

About offlineimap3, it is safe to use it instead with offlineimap configuration files? There is a package in Debian sid and testing for version 0.0~git20210225.1e7ef9e+dfsg-3 (not reassuring) but there is no offlineimap3 command after installing. And offlineimap3 are automatically installed when installing offlineimap. and even with offlineimap3 installed and offlineimap unistalled, "offlineimap -V" works and shows "offlineimap v7.3.0". I have some trouble to understand the situation... And all the doc for 3 version returns to offlineimap (not 3).

jishac commented 3 years ago

@pprw - When using OfflineIMAP3 the command is still offlineimap and not offlineimap3. I am not a regular Debian user, but it seems 7.3.3+dfsg1-1+0.0~git20210225.1e7ef9e+dfsg-3 is in fact using offlineimap3 and you should be able to confirm with the python version from the output of offlineimap -V

pprw commented 3 years ago

@pprw - When using OfflineIMAP3 the command is still offlineimap and not offlineimap3. I am not a regular Debian user, but it seems 7.3.3+dfsg1-1+0.0~git20210225.1e7ef9e+dfsg-3 is in fact using offlineimap3 and you should be able to confirm with the python version from the output of offlineimap -V

Indeed!

$ offlineimap -V
offlineimap v7.3.0, imaplib2 v3.05, Python v3.9.2, OpenSSL 1.1.1j  16 Feb 2021

Thanks for the explanation.