------------------------------------------------------------
revno: 1549
fixes bug: https://launchpad.net/bugs/1427389
committer: Mark Sapiro <m...@msapiro.net>
branch nick: 2.1
timestamp: Mon 2015-03-02 13:50:24 -0800
message:
  A LookupError in SpamDetect on a message with RFC 2047 encoded headers
  in an unknown character set is fixed.
modified:
  Mailman/Handlers/SpamDetect.py
  NEWS


--
lp:mailman/2.1
https://code.launchpad.net/~mailman-coders/mailman/2.1

Your team Mailman Checkins is subscribed to branch lp:mailman/2.1.
To unsubscribe from this branch go to 
https://code.launchpad.net/~mailman-coders/mailman/2.1/+edit-subscription
=== modified file 'Mailman/Handlers/SpamDetect.py'
--- Mailman/Handlers/SpamDetect.py	2014-07-10 20:25:39 +0000
+++ Mailman/Handlers/SpamDetect.py	2015-03-02 21:50:24 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2013 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2015 by the Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -77,7 +77,15 @@
         for frag, cs in v:
             if not cs:
                 cs = 'us-ascii'
-            uvalue += unicode(frag, cs, 'replace')
+            try:
+                uvalue += unicode(frag, cs, 'replace')
+            except LookupError:
+                # The encoding charset is unknown.  At this point, frag
+                # has been QP or base64 decoded into a byte string whose
+                # charset we don't know how to handle.  We will try to
+                # unicode it as iso-8859-1 which may result in a garbled
+                # mess, but we have to do something.
+                uvalue += unicode(frag, 'iso-8859-1', 'replace')
         headers += '%s: %s\n' % (h, uvalue.encode(cset, 'replace'))
     return headers
 

=== modified file 'NEWS'
--- NEWS	2015-03-01 16:35:02 +0000
+++ NEWS	2015-03-02 21:50:24 +0000
@@ -9,6 +9,9 @@
 
   Bug fixes and other patches
 
+    - A LookupError in SpamDetect on a message with RFC 2047 encoded headers
+      in an unknown character set is fixed.  (LP: #1427389)
+
     - Fixed a bug in CommandRunner that could process the second word of a
       body line as a command word and a case sensitivity in commands in
       Subject: with an Re: prefix.  (LP: #1426829)

_______________________________________________
Mailman-checkins mailing list
Mailman-checkins@python.org
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to