about summary refs log tree commit homepage
path: root/lib/PublicInbox/MailDiff.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-11-02 09:35:35 +0000
committerEric Wong <e@80x24.org>2023-11-03 06:39:31 +0000
commit41a5eb41f85d2fe3c433f4395572c9a926de55f2 (patch)
tree3de0cc13164182a26ff8cfd0800fe9a4bc4e21a2 /lib/PublicInbox/MailDiff.pm
parentbbccb5f1d90bf9605fc8473cb9f01bc453a82bf9 (diff)
downloadpublic-inbox-41a5eb41f85d2fe3c433f4395572c9a926de55f2.tar.gz
We have to deal with UTF-8 data for generating patches, so make
it easier to pass Perl utf8 data to git, diff, sdiff, etc. to
avoid "Wide character" warnings.
Diffstat (limited to 'lib/PublicInbox/MailDiff.pm')
-rw-r--r--lib/PublicInbox/MailDiff.pm3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/PublicInbox/MailDiff.pm b/lib/PublicInbox/MailDiff.pm
index c7b991f1..b1c12d6d 100644
--- a/lib/PublicInbox/MailDiff.pm
+++ b/lib/PublicInbox/MailDiff.pm
@@ -63,7 +63,6 @@ sub next_smsg ($) {
 sub emit_msg_diff {
         my ($bref, $self) = @_; # bref is `git diff' output
         # will be escaped to `&#8226;' in HTML
-        utf8::decode($$bref);
         $self->{ctx}->{ibx}->{obfuscate} and
                 obfuscate_addrs($self->{ctx}->{ibx}, $$bref, "\x{2022}");
         print { $self->{ctx}->{zfh} } '</pre><hr><pre>' if $self->{nr} > 1;
@@ -77,7 +76,7 @@ sub do_diff {
         my $dir = "$self->{tmp}/$n";
         $self->dump_eml($dir, $eml);
         my $cmd = [ qw(git diff --no-index --no-color -- a), $n ];
-        my $opt = { -C => "$self->{tmp}", quiet => 1 };
+        my $opt = { -C => "$self->{tmp}", quiet => 1, 1 => [':utf8', \my $o] };
         my $qsp = PublicInbox::Qspawn->new($cmd, undef, $opt);
         $qsp->psgi_qx($self->{ctx}->{env}, undef, \&emit_msg_diff, $self);
 }