Skip to content

Commit 2ba65c1

Browse files
committed
update
1 parent 7f77552 commit 2ba65c1

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

Mailman/Cgi/admindb.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,16 @@ def show_pending_subs(mlist, form):
376376
CheckBox(f'ban-%d' % id, 1).Format() +
377377
' ' + _('Permanently ban from this list') +
378378
'</label>')
379-
# While the address may be a unicode, it must be ascii
380-
paddr = addr.encode('us-ascii', 'replace')
381-
table.AddRow(['%s<br><em>%s</em><br>%s' % (paddr,
379+
# Ensure the address is properly decoded for display
380+
if isinstance(addr, bytes):
381+
try:
382+
addr = addr.decode('utf-8')
383+
except UnicodeDecodeError:
384+
try:
385+
addr = addr.decode('latin-1')
386+
except UnicodeDecodeError:
387+
addr = addr.decode('ascii', 'replace')
388+
table.AddRow(['%s<br><em>%s</em><br>%s' % (Utils.websafe(addr),
382389
Utils.websafe(fullname),
383390
displaytime),
384391
radio,

0 commit comments

Comments
 (0)