setlocale(NULL) should be more reliable than $ENV{LANG} rsync
authorMatthias Förste foerste@schlittermann.de
Mon, 20 Feb 2012 15:21:06 +0100
branchrsync
changeset 38 81214d8c7c1e
parent 37 a31ece02f311
child 39 c2e97355a239
setlocale(NULL) should be more reliable than $ENV{LANG}
bin/maybe-notify-uploader
--- a/bin/maybe-notify-uploader	Mon Feb 20 15:17:25 2012 +0100
+++ b/bin/maybe-notify-uploader	Mon Feb 20 15:21:06 2012 +0100
@@ -2,6 +2,7 @@
 
 use Mail::Sendmail;
 use MIME::EncWords qw(encode_mimewords);
+use POSIX qw(locale_h);
 
 my ($result, $codename, $source, $version, $changes) = @ARGV[0..4];
 
@@ -15,7 +16,7 @@
 }
 
 $r =~ $pat or $r = $fallback;
-$r = encode_mimewords($r, (Charset => $1)) if (defined $ENV{LANG} and $ENV{LANG} =~ /.*\.([^.]+)$/);
+$r = encode_mimewords($r, (Charset => $1)) if setlocale(NULL) =~ /.*\.([^.]+)$/;
 
 my $mail = {