Manlio Perillo wrote: > Try with: > > msg = MIMEText( > u'Some text with chars that need encoding: \xa3', > _charset='utf-8', > ) > > > and you will obtain the error: > > Traceback (most recent call last): > File "<pyshell#4>", line 3, in -toplevel- > _charset='utf-8', > File "C:\Python2.4\lib\email\MIMEText.py", line 28, in __init__ > self.set_payload(_text, _charset) > File "C:\Python2.4\lib\email\Message.py", line 218, in set_payload > self.set_charset(charset) > File "C:\Python2.4\lib\email\Message.py", line 260, in set_charset > self._payload = charset.body_encode(self._payload) > File "C:\Python2.4\lib\email\Charset.py", line 366, in body_encode > return email.base64MIME.body_encode(s) > File "C:\Python2.4\lib\email\base64MIME.py", line 136, in encode > enc = b2a_base64(s[i:i + max_unencoded]) > UnicodeEncodeError: 'ascii' codec can't encode character u'\xa3' in > position 41: ordinal not in range(128)
OK, but I fail to see how replacing one unicode error with another is any help... :-S Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk -- http://mail.python.org/mailman/listinfo/python-list