X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FViewDiff.pm;h=9a7adb57770f5843892438644eea38067c24e483;hb=c1e7a048be9d32cdca943bb3b7f935ed28768d4d;hp=fba3d76c7b0cc10473261380c081301f93b5b119;hpb=598dcdbead54e1d4746dea762c2c3cf292e796fc;p=public-inbox.git diff --git a/lib/PublicInbox/ViewDiff.pm b/lib/PublicInbox/ViewDiff.pm index fba3d76c..9a7adb57 100644 --- a/lib/PublicInbox/ViewDiff.pm +++ b/lib/PublicInbox/ViewDiff.pm @@ -7,8 +7,7 @@ # (or reconstruct) blobs. package PublicInbox::ViewDiff; -use strict; -use v5.10.1; +use v5.12; use parent qw(Exporter); our @EXPORT_OK = qw(flush_diff uri_escape_path); use URI::Escape qw(uri_escape_utf8); @@ -197,7 +196,8 @@ sub flush_diff ($$) { $top[0] =~ $IS_OID) { $dctx = diff_header(\$x, $ctx, \@top); } elsif ($dctx) { - open(my $afh, '>>', \(my $after='')) or die "open: $!"; + open(my $afh, '>>:utf8', \(my $after='')) or + die "open: $!"; # Quiet "Complex regular subexpression recursion limit" # warning. Perl will truncate matches upon hitting @@ -213,7 +213,7 @@ sub flush_diff ($$) { (?:(?:^-[^\n]*\n)+)| (?:^@@ [^\n]+\n))/xsm, $x)) { if (!defined($dctx)) { - print $afh $s; + print $afh $x; } elsif ($s =~ s/\A@@ (\S+) (\S+) @@//) { print $zfh qq(), diff_hunk($dctx, $1, $2), @@ -234,7 +234,10 @@ sub flush_diff ($$) { print $zfh $lnk->to_html($s); } } - diff_before_or_after($ctx, \$after) if !$dctx; + if (!$dctx) { + utf8::decode($after); + diff_before_or_after($ctx, \$after); + } } else { diff_before_or_after($ctx, \$x); }