EmailDistributor does not work for tickects with non-Ascii names
|Reported by:||dbely||Owned by:||Robert Corsaro|
AnnouncerPlugin (latest trunk r7413) fails while sending e-mail notification when the ticket's name is non-Ascii:
2010-01-18 18:41:47,439 Trac[email_distributor] DEBUG: EmailDistributor is sending event as 'text/html' to: firstname.lastname@example.org 2010-01-18 18:41:47,545 Trac[api] ERROR: AnnouncementSystem failed. Traceback (most recent call last): File "build/bdist.linux-x86_64/egg/announcerplugin/api.py", line 369, in _real_send distributor.distribute(transport, packages[transport], evt) File "build/bdist.linux-x86_64/egg/announcerplugin/distributors/email_distributor.py", line 227, in distribute self._do_send(transport, event, k, v, fmtdict[k]) File "build/bdist.linux-x86_64/egg/announcerplugin/distributors/email_distributor.py", line 346, in _do_send subject = "%s %s"%(prefix, subject) UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 12: ordinal not in range(128) 2010-01-18 18:41:47,546 Trac[api] DEBUG: AnnouncementSystem sent event in 0.12 seconds.
If I'm not mistaken, the problem is that in
subject = "%s %s"%(prefix, subject)
prefix is a unicode object but subjects is a string (utf-8?). So formatting operator try tries to convert the latter to unicode and fails.
The bug seems to be trivial but I am not familiar enough with AnnouncerPlugin's internals to propose a working fix myself.