SVN.pm produces "Wide character in setenv" warnings

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

 



"git svn fetch" causes Perl 5.18 or newer to emit "Wide character in
setenv" warnings when used in combination with svn.authorsfile with
non-ASCII names:

     Wide character in setenv at /usr/lib64/perl5/vendor_perl/5.20.1/Git/SVN.pm line 969.
     Wide character in setenv at /usr/lib64/perl5/vendor_perl/5.20.1/Git/SVN.pm line 973.

I have no taste of Perl so I do not propose this patch for inclusion,
but it fixes this for me.

diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm
index d9a52a5..2ffebfe 100644
--- a/perl/Git/SVN.pm
+++ b/perl/Git/SVN.pm
@@ -957,6 +957,17 @@ sub full_pushurl {
 	}
 }
 
+sub utf8_encode {
+	my ($s) = @_;
+	utf8::encode($s);
+	return $s;
+}
+
+sub UENV {
+	my ($var, $val) = @_;
+	$ENV{$var} = utf8_encode($val);
+}
+
 sub set_commit_header_env {
 	my ($log_entry) = @_;
 	my %env;
@@ -966,13 +977,13 @@ sub set_commit_header_env {
 		}
 	}
 
-	$ENV{GIT_AUTHOR_NAME} = $log_entry->{name};
+	UENV("GIT_AUTHOR_NAME", $log_entry->{name});
 	$ENV{GIT_AUTHOR_EMAIL} = $log_entry->{email};
 	$ENV{GIT_AUTHOR_DATE} = $ENV{GIT_COMMITTER_DATE} = $log_entry->{date};
 
-	$ENV{GIT_COMMITTER_NAME} = (defined $log_entry->{commit_name})
+	UENV("GIT_COMMITTER_NAME", (defined $log_entry->{commit_name})
 						? $log_entry->{commit_name}
-						: $log_entry->{name};
+						: $log_entry->{name});
 	$ENV{GIT_COMMITTER_EMAIL} = (defined $log_entry->{commit_email})
 						? $log_entry->{commit_email}
 						: $log_entry->{email};

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]