[Bug 1130957] Re: Unicode errors in mailman3

Aurélien Bompard aurelien at bompard.org
Thu Apr 11 17:56:43 CEST 2013


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.

-- 
You received this bug notification because you are a member of Mailman
Coders, which is subscribed to GNU Mailman.
https://bugs.launchpad.net/bugs/1130957

Title:
  Unicode errors in mailman3

To manage notifications about this bug go to:
https://bugs.launchpad.net/mailman/+bug/1130957/+subscriptions


More information about the Mailman-coders mailing list