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

[PATCH] mailer.py over-aggressively encodes Subject

From: Eric Gillespie <epg_at_pretzelnet.org>
Date: 2005-04-16 21:08:48 CEST

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.

Any objection if i commit this?

* tools/hook-scripts/mailer/mailer.py
  (MailedOutput.mail_headers): Only RFC 2047 encode the Subject
  header if it contains non-ASCII characters.

=== mailer.py
==================================================================
--- mailer.py (revision 2607)
+++ mailer.py (local)
@@ -185,7 +185,11 @@
 
   def mail_headers(self, group, params):
     from email.Header import Header
- subject = Header(self.make_subject(group, params), 'utf-8').encode()
+ subject = self.make_subject(group, params)
+ try:
+ subject.encode('ascii')
+ except UnicodeDecodeError:
+ subject = Header(subject, 'utf-8').encode()
     hdrs = 'From: %s\n' \
            'To: %s\n' \
            'Subject: %s\n' \

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Apr 16 21:09:40 2005

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