handle uploaders which need mime encoding in notification mails rsync
authorMatthias Förste foerste@schlittermann.de
Mon, 20 Feb 2012 15:17:25 +0100
branchrsync
changeset 37 a31ece02f311
parent 36 476655f48d19
child 38 81214d8c7c1e
handle uploaders which need mime encoding in notification mails
bin/rpi
--- a/bin/rpi	Mon Feb 20 13:31:29 2012 +0100
+++ b/bin/rpi	Mon Feb 20 15:17:25 2012 +0100
@@ -11,7 +11,9 @@
 use IPC::Run qw(run);
 use Getopt::Long;
 use Mail::Sendmail;
+use MIME::EncWords qw(encode_mimewords);
 use Pod::Usage;
+use POSIX qw(locale_h);
 use Sys::Hostname::Long;
 
 my %opt = ('run-lintian' => 1,);
@@ -144,7 +146,7 @@
 # verification command fails for some reason
 sub uploader($) {
     my ($c) = @_;
-    my $vc = "LANG=POSIX /usr/bin/gpg --verify $c 2>&1";
+    my $vc = "LC_MESSAGES=POSIX /usr/bin/gpg --verify $c 2>&1";
 
     my @r = qx{$vc};
 
@@ -386,6 +388,8 @@
                 $fallback
             ) if $dont_send_to_real_uploader;
 
+            $to = encode_mimewords($to, (Charset => $1)) if setlocale(NULL) =~ /.*\.([^.]+)$/;
+
             sendmail(
                 From    => $from,
                 Subject => $subject,