about summary refs log tree commit homepage
path: root/lib/PublicInbox/RepoAtom.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-10-09 17:56:23 +0000
committerEric Wong <e@80x24.org>2023-10-09 18:41:36 +0000
commit5754faeb3fa1c9aaeff8922b449127cfbc86236d (patch)
tree09381346561d119ef30d6465baacc44f8a9d32dd /lib/PublicInbox/RepoAtom.pm
parent02cd38ea042e01f343d52f8401cd56cf8e37dd9d (diff)
downloadpublic-inbox-5754faeb3fa1c9aaeff8922b449127cfbc86236d.tar.gz
We can't assume git output is UTF-8, and we'll always have
legacy data in git coderepos.  So attempt to display some
some garbled text rather than nothing at all if Perl croaks
on it.

sox commit c38987e8d20505621b8d872863afa7d233ed1096
(Added raw inverse-bit u-law and A-law support.  Updated *.txt files., 2001-12-13)
is an example of a commit which caused problems for me.
Diffstat (limited to 'lib/PublicInbox/RepoAtom.pm')
-rw-r--r--lib/PublicInbox/RepoAtom.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/PublicInbox/RepoAtom.pm b/lib/PublicInbox/RepoAtom.pm
index c89d4551..79b76c12 100644
--- a/lib/PublicInbox/RepoAtom.pm
+++ b/lib/PublicInbox/RepoAtom.pm
@@ -8,7 +8,7 @@ use parent qw(PublicInbox::GzipFilter);
 use POSIX qw(strftime);
 use URI::Escape qw(uri_escape);
 use Scalar::Util ();
-use PublicInbox::Hval qw(ascii_html);
+use PublicInbox::Hval qw(ascii_html utf8_maybe);
 
 # git for-each-ref and log use different format fields :<
 my $ATOM_FMT = '--pretty=tformat:'.join('%n',
@@ -50,7 +50,7 @@ sub translate {
         my $is_tag = $self->{-is_tag};
         my ($H, $ct, $an, $ae, $at, $s, $bdy);
         while ($lbuf =~ s/\A([^\0]+)\0\n//s) {
-                utf8::decode($bdy = $1);
+                utf8_maybe($bdy = $1);
                 if ($is_tag) {
                         my %r;
                         eval "$bdy";