From e9c0ea3f5bf29a9a039c132b0626ba2af4c8d802 Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Thu, 6 Sep 2012 16:58:03 -0700 Subject: Fixed a bug where non-ascii characters in the real name in a subscription request could throw a UnicodeEncodeError upon subscription approval and perhaps in other situations too. (LP: 1047100) --- Mailman/Logging/Syslog.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Mailman/Logging') diff --git a/Mailman/Logging/Syslog.py b/Mailman/Logging/Syslog.py index 531ab1d7..81e27214 100644 --- a/Mailman/Logging/Syslog.py +++ b/Mailman/Logging/Syslog.py @@ -62,6 +62,10 @@ class _Syslog: logf.write(msg + '\n') except UnicodeError: # Python 2.4 may fail to write 8bit (non-ascii) characters + # Also, if msg is unicode with non-ascii, quopri.encodestring() + # will throw UnicodeEncodeError, so avoid that. + if isinstance(msg, unicode): + msg = msg.encode('iso-8859-1', 'replace') logf.write(quopri.encodestring(msg) + '\n') # For the ultimate in convenience -- cgit v1.2.3