git/list[1] front-page[2] threads[3] people[4] search[5] about
 

SVN.pm produces "Wide character in setenv" warnings

From
ODOrivej Desh <orivej@gmx.fr>
Date
Feb 19, 2015, 06:49 UTC
Message-ID
<m3h9ui4cqe.fsf@gmx.fr>

"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};
Message 1 of 1 in “SVN.pm produces "Wide character in setenv" warnings”
  1. Orivej DeshFeb 19, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.