about summary refs log tree commit homepage
path: root/lib/PublicInbox/ViewVCS.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-08-22 06:44:12 +0000
committerEric Wong <e@80x24.org>2022-08-23 04:19:03 +0000
commit6b4e4f0d2d52a4b39c68d8f63915ddb7e1e8270e (patch)
tree61c62d64c1abc2271a5885143538a990187d96e7 /lib/PublicInbox/ViewVCS.pm
parent22dd13c407be75d2a5cad178593e78db8735d3bc (diff)
downloadpublic-inbox-6b4e4f0d2d52a4b39c68d8f63915ddb7e1e8270e.tar.gz
We'll also force --encoding=UTF-8 for "git show" even
if that's the default in git, since the rest of our code
already assumes UTF-8.
Diffstat (limited to 'lib/PublicInbox/ViewVCS.pm')
-rw-r--r--lib/PublicInbox/ViewVCS.pm8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/PublicInbox/ViewVCS.pm b/lib/PublicInbox/ViewVCS.pm
index 96883f6c..19d34092 100644
--- a/lib/PublicInbox/ViewVCS.pm
+++ b/lib/PublicInbox/ViewVCS.pm
@@ -144,7 +144,7 @@ committer $co$patchid
 <b>$s</b>\n
 EOM
         $ctx->zmore($bdy);
-        open $fh, '<', "$tmp/p" or die "open $tmp/p: $!";
+        open $fh, '<:utf8', "$tmp/p" or die "open $tmp/p: $!";
         if (-s $fh > $MAX_SIZE) {
                 $ctx->zmore("---\n patch is too large to show\n");
         } else { # prepare flush_diff:
@@ -171,8 +171,10 @@ sub show_commit ($$$$) {
         # a patch embedded inside the commit message body doesn't get fed
         # to patch-id:
         my $cmd = [ '/bin/sh', '-c',
-                "git show '$SHOW_FMT' -z --no-notes --no-patch $oid >h && ".
-                "git show --pretty=format:%n -M --stat -p $oid >p && ".
+                "git show --encoding=UTF-8 '$SHOW_FMT'".
+                " -z --no-notes --no-patch $oid >h && ".
+                'git show --encoding=UTF-8 --pretty=format:%n -M'.
+                " --stat -p $oid >p && ".
                 "git patch-id --stable <p" ];
         my $xenv = { GIT_DIR => $git->{git_dir} };
         my $tmp = File::Temp->newdir("show-$oid-XXXX", TMPDIR => 1);