All of lore.kernel.org
 help / color / mirror / Atom feed
* SVN.pm produces "Wide character in setenv" warnings
@ 2015-02-19  6:49 Orivej Desh
  0 siblings, 0 replies; only message in thread
From: Orivej Desh @ 2015-02-19  6:49 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 433 bytes --]

"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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: git-svn-env.patch --]
[-- Type: text/x-diff, Size: 1016 bytes --]

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};

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-02-19  6:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-19  6:49 SVN.pm produces "Wide character in setenv" warnings Orivej Desh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.