From 4fc195111db5d68eb97d259ed8bc67beae95302d Mon Sep 17 00:00:00 2001 From: tkikuchi <> Date: Sat, 17 Dec 2005 02:30:04 +0000 Subject: Python 2.4 may fail to write 8bit (non-ascii) characters. I think quoted-printable is the safest escape for logging. --- Mailman/Logging/Syslog.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Mailman') diff --git a/Mailman/Logging/Syslog.py b/Mailman/Logging/Syslog.py index b680d7f9..654ce64c 100644 --- a/Mailman/Logging/Syslog.py +++ b/Mailman/Logging/Syslog.py @@ -55,7 +55,12 @@ class _Syslog: # It's really bad if exceptions in the syslogger cause other crashes except Exception, e: msg = 'Bad format "%s": %s: %s' % (origmsg, repr(e), e) - logf.write(msg + '\n') + try: + logf.write(msg + '\n') + except UnicodeError: + # Python 2.4 may fail to write 8bit (non-ascii) characters + import quopri + logf.write(quopri.encodestring(msg) + '\n') # For the ultimate in convenience __call__ = write -- cgit v1.2.3