Properly decode payload

Bug #881312 reported by Vincent Fretin on 2011-10-25
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Mailman
High
Unassigned

Bug Description

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 <email address hidden>, 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.

Barry Warsaw (barry) on 2011-10-25
tags: added: mailman3
Barry Warsaw (barry) on 2012-04-07
Changed in mailman:
status: New → Triaged
importance: Undecided → High
tags: added: i18n
Abhilash Raj (raj-abhilash1) wrote :

Please Ignore this message, and any activity for next few minutes on this bug. Thi is for testing the api --maxking

Abhilash Raj (raj-abhilash1) wrote :

This bug has been moved to the new gitlab repo here: https://gitlab.com/maxking/mailman/issues/7

Abhilash Raj (raj-abhilash1) wrote :

Please ignore the above comment, the bug has been moved here: https://gitlab.com/mailman/mailman/issues/7

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers