Message252928
I don't see why/how this should be fixed in Python 3.
Using the example from msg109621 and Python 3.5.0, I get:
--- Logging error ---
Traceback (most recent call last):
File "/usr/lib/python3.5/logging/handlers.py", line 985, in emit
smtp.sendmail(self.fromaddr, self.toaddrs, msg)
File "/usr/lib/python3.5/smtplib.py", line 846, in sendmail
msg = _fix_eols(msg).encode('ascii')
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 108: ordinal not in range(128)
Call stack:
File "/tmp/x.py", line 8, in <module>
LOG.error(u"accentu\u00E9")
Message: 'accentué'
Arguments: ()
The problem is that an SMTP message is constructed and non-ASCII characters are not escaped in SMTPHandler.emit. A robust fix would be to use email.mime.text .MIMEText instead:
msg = MIMEText (msg)
msg['Subject'] = self.getSubject(record)
msg['From'] = self.fromaddr
msg['To'] = ",".join(self.toaddrs) |
|
Date |
User |
Action |
Args |
2015-10-13 13:09:10 | simon04 | set | recipients:
+ simon04, vinay.sajip, norbidur, cjw296, r.david.murray |
2015-10-13 13:09:10 | simon04 | set | messageid: <1444741750.52.0.579933593501.issue9208@psf.upfronthosting.co.za> |
2015-10-13 13:09:10 | simon04 | link | issue9208 messages |
2015-10-13 13:09:10 | simon04 | create | |
|