diff options
author | Eric Wong <e@80x24.org> | 2023-10-09 17:56:23 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-10-09 18:41:36 +0000 |
commit | 5754faeb3fa1c9aaeff8922b449127cfbc86236d (patch) | |
tree | 09381346561d119ef30d6465baacc44f8a9d32dd /lib/PublicInbox/ViewDiff.pm | |
parent | 02cd38ea042e01f343d52f8401cd56cf8e37dd9d (diff) | |
download | public-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/ViewDiff.pm')
-rw-r--r-- | lib/PublicInbox/ViewDiff.pm | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/PublicInbox/ViewDiff.pm b/lib/PublicInbox/ViewDiff.pm index 124a723a..d078c5f9 100644 --- a/lib/PublicInbox/ViewDiff.pm +++ b/lib/PublicInbox/ViewDiff.pm @@ -11,7 +11,7 @@ use v5.12; use parent qw(Exporter); our @EXPORT_OK = qw(flush_diff uri_escape_path); use URI::Escape qw(uri_escape_utf8); -use PublicInbox::Hval qw(ascii_html to_attr); +use PublicInbox::Hval qw(ascii_html to_attr utf8_maybe); use PublicInbox::Git qw(git_unquote); my $OID_NULL = '0{7,}'; @@ -236,7 +236,7 @@ sub flush_diff ($$) { } } if (!$dctx) { - utf8::decode($after); + utf8_maybe($after); diff_before_or_after($ctx, \$after); } } else { |