Problems with email.Generator.Generator

Chris Withers chris at simplistix.co.uk
Mon Sep 11 17:35:44 CEST 2006


Peter Otten wrote:
> http://sourceforge.net/tracker/?func=detail&aid=1409455&group_id=5470&atid=105470
>> Now, is this change to Generator.py in error or am I doing something
>> wrong?
> 
> I'm not familiar enough with the email package to answer that.

I'm hoping someone around here is ;-)

>> If the latter, how can I change my code such that it works as I'd expect?
> 
> email.Generator and email.Message use cStringIO.StringIO internally, which
> can't cope with unicode. A quick fix might be to monkey-patch:

I'm not sure that's correct, but I'm happy to stand corrected.

My understanding is that the StringIO's don't mind as long as they type 
is consistent - ie: con't mix unicode and encoded strings, 'cos it 
forced python's default ascii codec to kick in and spew unicode errors.

Now, I want to know what I'm supposed to do when I have unicode source 
and want it to end up as either a text/plain or text/html mime part.

Is there a how-to for this anywhere? The email package's docs are short 
on examples involving charsets, unicode and the like :-(

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk



More information about the Python-list mailing list