[Mailman-Users] UnicodeDecodeError in Commands/cmd_subscribe.py

David Relson relson at osagesoftware.com
Sun Jan 23 20:44:57 CET 2005


Greetings,

I just noticed this Traceback (and several older ones just like it):

Jan 23 14:28:08 2005 (1640) Traceback (most recent call last):
  File "/usr/lib/mailman/Mailman/Queue/Runner.py", line 111, in _oneloop
    self._onefile(msg, msgdata)
  File "/usr/lib/mailman/Mailman/Queue/Runner.py", line 167, in _onefile
    keepqueued = self._dispose(mlist, msg, msgdata)
  File "/usr/lib/mailman/Mailman/Queue/CommandRunner.py", line 239, in _dispose
    res.do_command('join')
  File "/usr/lib/mailman/Mailman/Queue/CommandRunner.py", line 137, in do_command
    return handler.process(self, args)
  File "/usr/lib/mailman/Mailman/Commands/cmd_subscribe.py", line 87, in process
    h = make_header(decode_header(realname))
  File "/home/relson/tmp/RPM/mailman-buildroot/usr/lib/mailman/pythonlib/email/Header.py", line 144, in make_header
  File "/home/relson/tmp/RPM/mailman-buildroot/usr/lib/mailman/pythonlib/email/Header.py", line 272, in append
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb3 in position 0: ordinal not in range(128)

Looking at the code, it looks like the fix should be (roughly) what's below.  Am I close???

Regards,

David

--- Mailman/Commands/cmd_subscribe.py.orig	2004-09-02 08:45:52.000000000 -0400
+++ Mailman/Commands/cmd_subscribe.py	2005-01-23 14:38:19.000000000 -0500
@@ -83,12 +83,12 @@
         if not address:
             res.results.append(_('No valid address found to subscribe'))
             return STOP
-        # Watch for encoded names
-        h = make_header(decode_header(realname))
-        # BAW: in Python 2.2, use just unicode(h)
-        realname = h.__unicode__()
-        # Coerce to byte string if uh contains only ascii
         try:
+            # Watch for encoded names
+            h = make_header(decode_header(realname))
+            # BAW: in Python 2.2, use just unicode(h)
+            realname = h.__unicode__()
+            # Coerce to byte string if uh contains only ascii
             realname = realname.encode('us-ascii')
         except UnicodeError:
             pass





More information about the Mailman-Users mailing list