Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Best efforts decoding of output from diff command
diff --git a/lib/MetaCPAN/Server/Diff.pm b/lib/MetaCPAN/Server/Diff.pm
index 2f90e6e..98c6306 100644
--- a/lib/MetaCPAN/Server/Diff.pm
+++ b/lib/MetaCPAN/Server/Diff.pm
@@ -2,6 +2,7 @@ package MetaCPAN::Server::Diff;
use Moose;
use IPC::Run3;
+use Encoding::FixLatin qw(fix_latin);
has git => ( is => 'ro', required => 1 );
has [qw(source target)] => ( is => 'ro', required => 1 );
@@ -17,7 +18,7 @@ sub _build_raw {
(my $stats = $raw ) =~ s/^([^\n]*\0).*$/$1/s;
$self->numstat($stats);
$raw = substr($raw, length($stats));
- return $raw;
+ return fix_latin($raw);
}
sub _build_structured {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment