[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] mailer.py over-aggressively encodes Subject

From: C. Michael Pilato <cmpilato_at_collab.net>
Date: 2005-04-17 00:08:25 CEST

Eric Gillespie <epg@pretzelnet.org> writes:

> With r13453, our commit mailer suddenly started sending out RFC
> 2047 encoded Subject headers for no reason:
> Subject: =?utf-8?q?svn_commit=3A_r13453_-_in_branches/locking/subvers?=
> =?utf-8?q?ion=3A_clients/cmdline_include_libsvn=5Fsubr_svnadmin?=
> Subject: svn commit: r13453 - in branches/locking/subversion:
> clients/cmdline include libsvn_subr svnadmin
> This is due to mailer.py r14222. We should only be doing this if
> the header actually contains characters absent from 7-bit ASCII,
> which is clearly not the case here (or for any of the mails that
> have arrived since then). This is very annoying when looking at
> raw message files, as i frequently do.

Heheh. I had the following patch ready to commit:

   def mail_headers(self, group, params):
- from email.Header import Header
- subject = Header(self.make_subject(group, params), 'utf-8').encode()
+ # Get our Subject: line, MIME-encoding if any of the characters
+ # have ordinal values > 127
+ subject = self.make_subject(group, params)
+ if True in [ord(subject[i]) > 127 for i in range(len(subject))]: # woot!
+ from email.Header import Header
+ subject = Header(subject, 'utf-8').encode()
     hdrs = 'From: %s\n' \
            'To: %s\n' \
            'Subject: %s\n' \

But yours was much less obfuscated. :-) Please do commit it up.

To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Apr 17 00:12:42 2005

This is an archived mail posted to the Subversion Dev mailing list.