Been bothered with these on and off errors in our application while sending email via python:
File "/usr/lib/python2.4/email/Generator.py", line 182, in handletext self._fp.write(payload)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2014' in position 4986: ordinal not in range(128)
The reason is that Python's email module needs some information about charset used when a MIMEText object is created.
Here is a link which explians how to solve this:
Links to understand unicode in Python: