From ce39f8e0006253b7dd3489dbd414b5d4758c66ac Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 25 Jan 2009 23:13:14 -0500 Subject: [PATCH] git: Fix malformed utf8 recieved from git. If git log outputs malformed utf8 in, eg, usernames, detect it and fix it up. This avoids commits such as f71abc92aa279fbe0b7578b8c4752d775dd4a259 breaking things. --- IkiWiki/Plugin/git.pm | 6 ++++++ debian/changelog | 1 + 2 files changed, 7 insertions(+) diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index 3085a3b67..042c69f5a 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -139,6 +139,12 @@ sub safe_git (&@) { my @lines; while (<$OUT>) { chomp; + + # check for invalid utf-8, and toss it back to avoid crashes + if (! utf8::valid($_)) { + $_=encode_utf8($_); + } + push @lines, $_; } diff --git a/debian/changelog b/debian/changelog index c9ebcd1e9..6c1710fe1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,7 @@ ikiwiki (3.03) UNRELEASED; urgency=low * comments: If comment content checks fail, store the comment (in .ikiwiki/comments_pending) for moderator review. * comments: Add a moderation web interface. + * git: Fix malformed utf8 recieved from git. -- Joey Hess Sun, 18 Jan 2009 14:50:57 -0500 -- 2.26.2