On 1/1/23 08:14, Eggert Ehmke via Mailman-users wrote:
I edited this file: venv/lib/python3.9/site-packages/mailman/commands/cli_members.py
The content at line 107ff is: #patch of Mark Sapiro # if email_only: if email_only or not address.display_name: print(address.original_email, file=outfp) else: # print(formataddr((address.display_name, address.original_email)), file=outfp) print(f'{address.display_name} <{address.original_email}>', file=outfp)
This file is actually executed when I call mailman members. I verified this by uncommenting the first (old) print line. Now each address is printed twice (as expected), with the utf8 code in both lines in case of umlauts.
In that case the address.display_name value is the RFC 2047 encoded name. One way this can happen is if the subscribe was via email prior to Mailman 3.3.3. See https://gitlab.com/mailman/mailman/-/issues/802.
You could try something like this to fix these.
mailman shell
Welcome to the GNU Mailman shell
Use commit() to commit changes.
Use abort() to discard changes since the last commit.
Exit with ctrl+D does an implicit commit() but exit() does not.
>>> um = getUtility(IUserManager)
>>> from email.header import decode_header, make_header
>>> for address in um.addresses:
... decoded = str(make_header(decode_header(address.display_name)))
... if decoded != address.display_name:
... address.display_name = decoded
... print(f'Fixed {decoded}')
...
>>> # while you're at it do users too.
>>> for user in um.users:
... decoded = str(make_header(decode_header(user.display_name)))
... if decoded != user.display_name:
... user.display_name = decoded
... print(f'Fixed {decoded}')
...
>>> commit()
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan