]> Sergey Matveev's repositories - public-inbox.git/commitdiff
mda: encoding-aware From: for GIT_ authorship
authorEric Wong <e@80x24.org>
Tue, 15 Apr 2014 06:00:16 +0000 (06:00 +0000)
committerEric Wong <e@80x24.org>
Tue, 15 Apr 2014 06:00:16 +0000 (06:00 +0000)
Users with non-US-ASCII compatible names were not showing
up properly in "git log" output.

public-inbox-mda

index 6e66fa71da63c56ccfcf3cfea5390696ae01e117..2335cd3e068437321f58cfd83b396a8d8fa266ad 100755 (executable)
@@ -7,6 +7,8 @@ my $usage = 'public-inbox-mda < rfc2822_message';
 
 use Email::Filter;
 use Email::Address;
+use Encode qw/decode encode/;
+use Encode::MIME::Header;
 use File::Path::Expand qw/expand_filename/;
 use IPC::Run qw(run);
 use constant MDA => 'ssoma-mda';
@@ -45,7 +47,8 @@ if (PublicInbox->precheck($filter, $recipient) &&
                        set_list_headers($simple, $dst);
                        $filter->simple($simple);
 
-                       my $from = $filter->from;
+                       my $from = decode('MIME-Header', $filter->from);
+                       $from = encode("utf8", $from);
                        my @from = Email::Address->parse($from);
                        my $name = $from[0]->name;
                        defined $name or $name = "";