[New-bugs-announce] [issue9208] SMTPHandler does not handle unicode strings

norbidur report at bugs.python.org
Fri Jul 9 00:16:11 CEST 2010


New submission from norbidur <norbidur at users.sourceforge.net>:

SMTPHandler fails when receiving unicode strings.

example : 
import logging,logging.handlers
smtpHandler = logging.handlers.SMTPHandler(
    mailhost=("smtp.free.fr",25),
    fromaddr="from at free.fr", toaddrs="to at free.fr",
    subject=u"error message")
LOG = logging.getLogger()
LOG.addHandler(smtpHandler)
LOG.error(u"accentu\u00E9")

-> UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 108 : ordinal not in range(128)

There has been a discuss on this in http://groups.google.com/group/comp.lang.python/browse_thread/thread/759df42f9374d1b6/05ad55c388c746e3?lnk=raot&pli=1

FileHandler does not behave the same way : for this handler's family an encoding can be specified, and if this encoding fails, there is a fallback to UTF-8.

----------
components: Unicode
messages: 109621
nosy: norbidur
priority: normal
severity: normal
status: open
title: SMTPHandler does not handle unicode strings
type: behavior
versions: Python 2.5, Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9208>
_______________________________________


More information about the New-bugs-announce mailing list