[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:10:07 CEST

Eric Gillespie <epg@pretzelnet.org> writes:

> ==================================================================
> --- 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' \

And as a minor optimization, you can move the import of Header into
the "except" clause.

---------------------------------------------------------------------
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:14:20 2005

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