Fail of handling character set in template causes message loss for HTML mail
I have a few footers in Swedish (so mailed using iso-8859-1, utf-8 or something else supporting åäöÅÄÖ and some latin accented characters). This seems to work if the handled message is in plain text (the server runs utf-8, IIRC). When the handled message is in HTML the message handling crashes and the message is lost silently.
I have used the workaround setting the list default language to "sv" but that is a bit unsatisfactory. It would be better if the footer was lost and the message sent on or held with an error message as a reason while moderator was notified.
Sep 29 19:00:00 2017 (14482) Uncaught runner exception: 'ascii' codec can't encode character '\xe5' in position 216: ordinal not in range(128)
Sep 29 19:00:00 2017 (14482) Traceback (most recent call last):
File ".../mailman-3.2.0a1-py3.5.egg/mailman/core/runner.py", line 173, in _one_iteration
self._process_one_file(msg, msgdata)
File ".../mailman-3.2.0a1-py3.5.egg/mailman/core/runner.py", line 266, in _process_one_file
keepqueued = self._dispose(mlist, msg, msgdata)
File ".../mailman-3.2.0a1-py3.5.egg/mailman/runners/outgoing.py", line 93, in _dispose
self._func(mlist, msg, msgdata)
File ".../mailman-3.2.0a1-py3.5.egg/mailman/mta/deliver.py", line 86, in deliver
refused = agent.deliver(mlist, msg, msgdata)
File ".../mailman-3.2.0a1-py3.5.egg/mailman/mta/base.py", line 163, in deliver
callback(mlist, message_copy, msgdata_copy)
File ".../mailman-3.2.0a1-py3.5.egg/mailman/mta/decorating.py", line 32, in decorate
decorator.process(mlist, msg, msgdata)
File ".../mailman-3.2.0a1-py3.5.egg/mailman/handlers/decorate.py", line 247, in process
process(mlist, msg, msgdata)
File ".../mailman-3.2.0a1-py3.5.egg/mailman/handlers/decorate.py", line 193, in process
mimeftr = MIMEText(footer.encode(lcset), 'plain', lcset)
(path substituted with "...")