RESOLVED FIXED215330
[ews] Handle logs with unicode characters in ews emails
https://bugs.webkit.org/show_bug.cgi?id=215330
Summary [ews] Handle logs with unicode characters in ews emails
Aakash Jain
Reported 2020-08-10 12:21:27 PDT
We added relevant log information in ews emails in r265302. However, logs with unicode characters results in following exception. We should handle them properly. Traceback (most recent call last): File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 1475, in gotResult _inlineCallbacks(r, g, status) File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 1421, in _inlineCallbacks status.deferred.callback(getattr(e, "value", None)) File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 460, in callback self._startRunCallbacks(result) File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 568, in _startRunCallbacks self._runCallbacks() --- <exception caught here> --- File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "steps.py", line 1401, in <lambda> d.addCallback(lambda res: self.analyzeResults()) File "steps.py", line 1422, in analyzeResults self.send_email_for_new_build_failure() File "steps.py", line 1492, in send_email_for_new_build_failure email_text += '\n\nError lines:\n\n{}'.format(logs) exceptions.UnicodeEncodeError: 'ascii' codec can't encode character u'\u2018' in position 108: ordinal not in range(128)
Attachments
Patch (3.12 KB, patch)
2020-08-10 12:24 PDT, Aakash Jain
darin: review+
Aakash Jain
Comment 1 2020-08-10 12:24:46 PDT
Aakash Jain
Comment 2 2020-08-10 12:36:04 PDT
Radar WebKit Bug Importer
Comment 3 2020-08-10 12:37:56 PDT
dewei_zhu
Comment 4 2020-08-10 12:41:55 PDT
Comment on attachment 406318 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=406318&action=review > Tools/BuildSlaveSupport/ews-build/send_email.py:43 > + email_data = """From: {}\nTo: {}\nSubject: {}\n\n{}""".format(FROM_EMAIL, ', '.join(to_emails), subject, text.encode('utf-8')) Any reason that we don't do it for `subject`?
Aakash Jain
Comment 5 2020-08-10 13:08:41 PDT
(In reply to dewei_zhu from comment #4) > Any reason that we don't do it for `subject`? Good point. Let me do that in a separate patch.
Jonathan Bedard
Comment 6 2020-08-11 09:21:30 PDT
Comment on attachment 406318 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=406318&action=review >> Tools/BuildSlaveSupport/ews-build/send_email.py:43 >> + email_data = """From: {}\nTo: {}\nSubject: {}\n\n{}""".format(FROM_EMAIL, ', '.join(to_emails), subject, text.encode('utf-8')) > > Any reason that we don't do it for `subject`? Fine for now, but. this may be a case for using webkitcorepy, because this encoding will be unneeded in Python 3.
Note You need to log in before you can comment on or make changes to this bug.