Properly decode payload
Original LP Author: Vincent Fretin , LP Link: https://bugs.launchpad.net/bugs/881312
With mailman 3.0.0a8 in src/mailman/runners/command.py, there is an issue with body = part.get_payload(decode=True) if you send a mail to test-unsubscribe@example.com, with accents in the mail, in the signature for example, you get a body string encoded in iso-8859-1.
When you try to concatenate iso-8859-1 string with unicode, this the case when the mail body with "Unprocessed:" and "Ignored:" is generated, you get a UnicodeDecodeError ascii.
The code should be modified to correctly decode the mail body like it is done in src/mailman/pipeline/decorate.py mcset = msg.get_content_charset() or 'us-ascii' unicode(msg.get_payload(decode=True), mcset)
There are similar issues in src/mailman/rules/administrivia.py with the line: if line == '': where it give you a warning because it compare an iso to an empty unicode.
and in src/mailman/rules/approved.py where it simply crashes:
Oct 18 17:54:41 2011 (18207) Traceback (most recent call last):
File "/home/zope/mailman/src/mailman/core/runner.py", line 138, in _one_iteration
self._process_one_file(msg, msgdata)
File "/home/zope/mailman/src/mailman/core/runner.py", line 220, in _process_one_file
keepqueued = self._dispose(mlist, msg, msgdata)
File "/home/zope/mailman/src/mailman/runners/incoming.py", line 65, in _dispose
process(mlist, msg, msgdata, mlist.start_chain)
File "/home/zope/mailman/src/mailman/core/chains.py", line 68, in process
if link.rule.check(mlist, msg, msgdata):
File "/home/zope/mailman/src/mailman/rules/approved.py", line 81, in check
if ':' in line:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe0 in position 14: invalid continuation byte
Currently, mailman is unusable for another language than English, like French.