docker-offlineimap/offlineimap
Thomas De Schampheleire 33e0efa163 IMAP: replace non-UTF-8 characters rather than aborting
Emails received may not be UTF-8. Following error was observed on a specific
mail:

Traceback (most recent call last):
  File "/home/tdescham/repo/offlineimap3/offlineimap/threadutil.py", line 146, in run
    Thread.run(self)
  File "/usr/lib/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/tdescham/repo/offlineimap3/offlineimap/folder/Base.py", line 850, in copymessageto
    message = self.getmessage(uid)
  File "/home/tdescham/repo/offlineimap3/offlineimap/folder/IMAP.py", line 327, in getmessage
    data = self._fetch_from_imap(str(uid), self.retrycount)
  File "/home/tdescham/repo/offlineimap3/offlineimap/folder/IMAP.py", line 844, in _fetch_from_imap
    ndata1 = data[0][1].decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 in position 10177: invalid start byte

This completely aborted offlineimap3, blocking further mail reception.

Instead, use the 'replace' error strategy in Python:

    Replace with a suitable replacement character; Python will use the
    official U+FFFD REPLACEMENT CHARACTER for the built-in Unicode codecs on
    decoding and ‘?’ on encoding.
    https://docs.python.org/2/library/codecs.html#codec-base-classes
2020-10-21 16:29:13 +02:00
..
folder IMAP: replace non-UTF-8 characters rather than aborting 2020-10-21 16:29:13 +02:00
repository Changed doxygen parameter 2020-10-10 17:48:30 +02:00
ui ui/UIBase.py do not use builtin object as variable 2020-08-30 18:12:17 +02:00
utils utils/const.py Removed extra characters 2020-08-30 18:14:15 +02:00
__init__.py Reformat offlineimap/__init__.py 2020-08-29 20:04:40 +02:00
accounts.py accounts: decode output of hooks 2020-10-12 09:01:59 +02:00
CustomConfig.py six: changed offlineimap/CustomConfig.py 2020-09-03 21:35:54 +02:00
emailutil.py emailutil.py updated docstrings 2020-08-30 18:21:00 +02:00
error.py Reformat offlineimap/error.py 2020-08-29 20:15:55 +02:00
globals.py Reformat offlineimap/globals.py 2020-08-29 20:16:35 +02:00
imaplibutil.py six: changed offlineimap/imaplibutil.py 2020-09-03 21:36:02 +02:00
imapserver.py imapserver.py: fix __xoauth2handler in Python 3 2020-09-29 10:04:07 +02:00
imaputil.py Allow folder names with atom specials 2020-10-11 23:01:08 +02:00
init.py removed virtual_imaplib2 2020-08-31 16:24:26 +02:00
localeval.py localeval.py removed extra parenthesys 2020-08-30 18:52:56 +02:00
mbnames.py mbnames.py removed extra parenthesys 2020-08-30 18:53:02 +02:00
threadutil.py Removed doxygen param 2020-10-10 14:50:47 +02:00