Comment 5 for bug 1130957

Revision history for this message
Aurélien Bompard (abompard) wrote :

OK, thanks to Toshio, I *finally* know what's going on here. Because of the import of "unicode_literals" from __future__ at the top of the file, the call to .split("\n\n") is actually interpreted as .split(u"\n\n"), thus the result is a list of unicode strings, which of course can't be decoded further in the following lines. To keep string literals, the string should be prefixed with "b", here's the patch:

=== modified file 'src/mailman/runners/digest.py'
--- src/mailman/runners/digest.py 2013-01-01 14:05:42 +0000
+++ src/mailman/runners/digest.py 2013-04-11 15:52:53 +0000
@@ -260,7 +260,7 @@
         # Add the payload. If the decoded payload is empty, this may be a
         # multipart message. In that case, just stringify it.
         payload = msg.get_payload(decode=True)
- payload = (payload if payload else msg.as_string().split('\n\n', 1)[1])
+ payload = (payload if payload else msg.as_string().split(b'\n\n', 1)[1])
         try:
             charset = msg.get_content_charset('us-ascii')
             payload = unicode(payload, charset, 'replace')

That's one of the errors I reported in this but, I'll investigate the other one now.