[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Fixing svn-close-hook for people with accents in their names



Hi.

On 25/08/2011 11:46, Raphael Hertzog wrote:
> Hi,
> 
> I have always been the poor guy who can't rely on svn-closes-hook to
> closes bugs directly via the SVN commits notices because I have an accent
> in my name and I get those bounces.
> 
> I never cared enough to investigate myself but maybe someone else with
> more motivation is willing to look into it. So I'm sending this mail just
> in case Giov^H^H^H^Hsomeone wants to give it a go. :-)

You could try the patch attached, but there is a nice XML disclaimer:

<disclaimer>
 <li>I don't know Perl.</li>
 <li>I managed to write those Perl lines more or less by trial and
error, mainly copying from the documentation.</li>
 <li>I didn't try my patch (the trials and errors were done on a smaller
dedicated program).</li>
 <li>My patch is probably bad Perl style.</li>
 <li>I would never trust it.</li>
 <li>I really don't like Perl.</li>
 <li>Yes, I know that soon or late I'll have to learn it. But let's try
to push this day as late as possible.</li>
</disclaimer>

This, of course, means that I'm not going to commit the patch. :-)

Giovanni.
-- 
Giovanni Mascellani <mascellani@poisson.phc.unipi.it>
Pisa, Italy

Web: http://poisson.phc.unipi.it/~mascellani
Jabber: g.mascellani@jabber.org / giovanni@elabor.homelinux.org

-- 
Giovanni Mascellani <mascellani@poisson.phc.unipi.it>
Pisa, Italy

Web: http://poisson.phc.unipi.it/~mascellani
Jabber: g.mascellani@jabber.org / giovanni@elabor.homelinux.org
From baaba912d7ab06466e4b2566cf5079422b0d59cf Mon Sep 17 00:00:00 2001
From: Giovanni Mascellani <mascellani@poisson.phc.unipi.it>
Date: Thu, 25 Aug 2011 14:59:36 +0200
Subject: [PATCH] Encode correctly non 7-bit From: headers.

---
 bin/svn-closes-hook |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/bin/svn-closes-hook b/bin/svn-closes-hook
index ec24198..19b1c6e 100755
--- a/bin/svn-closes-hook
+++ b/bin/svn-closes-hook
@@ -18,6 +18,9 @@ use strict;
 use Mail::Send;
 use File::Basename qw(basename);
 use Sys::Hostname::Long;
+use Encode::MIME::Header;
+
+use Encode qw/encode decode/;
 
 my( $repo_path, $revision ) = @ARGV;
 
@@ -38,12 +41,13 @@ exit unless @bugs;
 my @who = getpwuid($<);
 my $author = $who[0];
 my $author_name = $who[6];
+my $encoded_author_name=encode('MIME-Q', $author_name);
 my $hostname = hostname_long;
 
 my $msg = Mail::Send->new(
   Subject => "qa.debian.org bug fixed in revision $revision",
 );
-$msg->add('From', "$author_name <$author\@$hostname>");
+$msg->add('From', "$encoded_author_name <$author\@$hostname>");
 $msg->add('X-Mailer', (basename $0).' running on '.hostname_long);
 $msg->add('X-Svn-Repository', $repo_path);
 $msg->add('X-Debian', 'qa.debian.org');
-- 
1.7.5.4

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: