diff --git a/Mailman/MailList.py b/Mailman/MailList.py index a7514d6..32af36d 100644 --- a/Mailman/MailList.py +++ b/Mailman/MailList.py @@ -1024,6 +1024,11 @@ def AddMember(self, userdesc, remote=None): del msg['auto-submitted'] msg['Auto-Submitted'] = autosub msg.send(self) + + # formataddr() expects a str and does its own encoding + if isinstance(name, bytes): + name = name.decode(Utils.GetCharSet(lang)) + who = formataddr((name, email)) syslog('subscribe', '%s: pending %s %s', self.internal_name(), who, by) @@ -1100,6 +1105,12 @@ def ApprovedAddMember(self, userdesc, ack=None, admin_notif=None, text='', kind = ' (digest)' else: kind = '' + + # The formataddr() function, used in two places below, takes a str and performs + # its own encoding, so we should not allow the name to be pre-encoded. + if isinstance(name, bytes): + name = name.decode(Utils.GetCharSet(lang)) + syslog('subscribe', '%s: new%s %s, %s', self.internal_name(), kind, formataddr((name, email)), whence) if ack: @@ -1122,10 +1133,6 @@ def ApprovedAddMember(self, userdesc, ack=None, admin_notif=None, text='', finally: i18n.set_translation(otrans) - # The formataddr() function takes a str and performs its own encoding, so we should not allow the name to be pre-encoded - if isinstance(name, bytes): - name = name.decode(Utils.GetCharSet(lang)) - text = Utils.maketext( "adminsubscribeack.txt", {"listname" : realname,