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)
Created attachment 406318 [details] Patch
Committed r265442: <https://trac.webkit.org/changeset/265442>
<rdar://problem/66794326>
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`?
(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.
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.