aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman/Handlers/Scrubber.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Mailman/Handlers/Scrubber.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Mailman/Handlers/Scrubber.py b/Mailman/Handlers/Scrubber.py
index b5be73df..7bc5f510 100644
--- a/Mailman/Handlers/Scrubber.py
+++ b/Mailman/Handlers/Scrubber.py
@@ -301,8 +301,11 @@ Url : %(url)s
try:
t = unicode(t, partcharset, 'replace')
except (UnicodeError, LookupError):
- # Replace funny characters
- t = unicode(t, 'ascii', 'replace').encode('ascii')
+ # Replace funny characters. We use errors='replace' for
+ # both calls since the first replace will leave U+FFFD,
+ # which isn't ASCII encodeable.
+ u = unicode(t, 'ascii', 'replace')
+ t = u.encode('ascii', 'replace')
try:
# Should use HTML-Escape, or try generalizing to UTF-8
t = t.encode(charset, 'replace')