SMTPHandler and Unicode

Chris Withers chris at simplistix.co.uk
Fri Jan 13 15:17:23 EST 2012


Hi Norbert,

On 05/07/2010 13:22, norbert wrote:
> On 5 juil, 13:17, Chris Withers<ch... at simplistix.co.uk>  wrote:
>> try MailingLogger:
>>
>> If you have unicode problems with that, I'd be interested in fixing them!
>
> Your package has the same unicode problem :
> import logging,logging.handlers
> from mailinglogger.MailingLogger import MailingLogger
> mailingLogger = MailingLogger(mailhost=('smtp.example.com',
> 25),fromaddr='toto at example.com',toaddrs=('toto at example.com',))
> LOG = logging.getLogger()
> LOG.addHandler(mailingLogger)
> LOG.error(u"sans accent")
> LOG.error(u"accentu\u00E9")
>
> -->  UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9'
> in position 7: ordinal not in range(128)

It's taken a ridiculously long amount of time (sadly due to no-one else 
complaining) but this is now fixed in the source control for 
mailinglogger, and will be in the next release:

https://github.com/Simplistix/testfixtures

cheers,

Chris

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



More information about the Python-list mailing list