i am trying to set up some scheduled tasks which will have to send
emails.
the email-content is to be rendered by kid and then passed to an
instance of TurboMail.Message
the template is rendered correctly, but when passing it to the
message, i receive encoding errors.
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
67: ordinal not in range(128).
what can i do about that? i think i´m using the latest version of
turbomail 2.0.3
Regards,
Frank
once I have had the same error-message (working with an utf-8 encoded
database)
it was solved by creating the file
/usr/lib64/python2.4/site-packages/sitecustomize.py
containing the two following lines :
import sys
sys.setdefaultencoding("utf-8")
but this can disturb your non utf-8 python-scripts
happy pythoning
Herbert
Because of this it's a really bad advice. Don't do that!
Diez
Showing us the code would help. I'm sending utf-8-encoded emails just fine
using TurboMail & don't have to tweak the systems default encoding.
Diez
nothing special i think...?
On 4 Mai, 10:56, "Diez B. Roggisch" <diez.roggi...@artnology.com>
wrote:
Well, apart from you not passing the subject and the rendered not as
unicode-objects, but as byte-strings of course.
Which will result in the byte-string being encoded to a unicode object with
the standard encoding - ascii.
And of course that fails.
I do it like this:
message.rich = unicode(kid_engine.render(params,
template='varms.templates.sales.groupvisits_email'), 'utf-8')
Diez
that works perfectly.
Frank
On 4 Mai, 14:07, "Diez B. Roggisch" <diez.roggi...@artnology.com>
wrote: