From c43087be33f78a895b74869800a775c4a0cb9a27 Mon Sep 17 00:00:00 2001 From: bwarsaw <> Date: Mon, 22 Sep 2003 02:37:51 +0000 Subject: Backporting from the HEAD -- updated handlers --- Mailman/Handlers/Scrubber.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Mailman/Handlers/Scrubber.py') 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') -- cgit v1.2.3