aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman/Logging
diff options
context:
space:
mode:
authorMark Sapiro <msapiro@value.net>2012-09-06 16:58:03 -0700
committerMark Sapiro <msapiro@value.net>2012-09-06 16:58:03 -0700
commite9c0ea3f5bf29a9a039c132b0626ba2af4c8d802 (patch)
treec077caec3d822d6613ce1f1947d41d8a8be9fc94 /Mailman/Logging
parentbaa86ef21a9a242ed61e99547716ed7b3b12a7df (diff)
downloadmailman2-e9c0ea3f5bf29a9a039c132b0626ba2af4c8d802.tar.gz
mailman2-e9c0ea3f5bf29a9a039c132b0626ba2af4c8d802.tar.xz
mailman2-e9c0ea3f5bf29a9a039c132b0626ba2af4c8d802.zip
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)
Diffstat (limited to 'Mailman/Logging')
-rw-r--r--Mailman/Logging/Syslog.py4
1 files changed, 4 insertions, 0 deletions
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