[Python-apps-team] Bug#593613: trac-email2trac: Error on wrongly encoded e-mail

W. Martin Borgert debacle at debian.org
Thu Aug 19 16:32:56 UTC 2010


Package: trac-email2trac
Version: 1.0.0-1
Tags: patch

I had not the time to analyse this problem in all depth,
but is seems that unicode data hurts the Python 2.6
function email.header.decode_header(). E.g.
email.header.decode_header(u'\xe4') throws a
UnicodeEncodeError. It seems that such a unicode string
can be passed to it via email2tracs
TicketEmailParser.email_to_unicode().

I worked around the problem with a little hack at the start
of TicketEmailParser.email_to_unicode() in email2trac:

     if type(message_str) == unicode:
         message_str = message_str.encode('utf-8'))

Comments?






More information about the Python-apps-team mailing list