diff options
| author | Barry Warsaw | 2016-04-30 13:34:04 -0400 |
|---|---|---|
| committer | GitLab | 2016-04-30 19:54:54 +0000 |
| commit | c6eb7ee3e574b48ee016dd31af2014b0ed083268 (patch) | |
| tree | 14c1f1e7bb382898ee50909333365aab335aa4a1 /src/mailman/runners/command.py | |
| parent | 465f24ff33e154385322ee894d32d8b7dd9b3941 (diff) | |
| download | mailman-c6eb7ee3e574b48ee016dd31af2014b0ed083268.tar.gz mailman-c6eb7ee3e574b48ee016dd31af2014b0ed083268.tar.zst mailman-c6eb7ee3e574b48ee016dd31af2014b0ed083268.zip | |
Diffstat (limited to 'src/mailman/runners/command.py')
| -rw-r--r-- | src/mailman/runners/command.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/mailman/runners/command.py b/src/mailman/runners/command.py index 13d52ce75..00f6f416b 100644 --- a/src/mailman/runners/command.py +++ b/src/mailman/runners/command.py @@ -25,6 +25,7 @@ import re import logging +from contextlib import suppress from email.errors import HeaderParseError from email.header import decode_header, make_header from email.iterators import typed_subpart_iterator @@ -224,11 +225,9 @@ class CommandRunner(Runner): # utf-8. reply_body = str(results) for charset in (results.charset, 'us-ascii', 'latin-1'): - try: + with suppress(UnicodeError): reply_body.encode(charset) break - except UnicodeError: - pass else: charset = 'utf-8' reply.set_payload(reply_body, charset=charset) |
