summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-01-25 23:13:14 -0500
committerJoey Hess <joey@gnu.kitenet.net>2009-01-25 23:13:14 -0500
commitce39f8e0006253b7dd3489dbd414b5d4758c66ac (patch)
tree23494d7b0ec368f0f390e337936081640c18b55f /IkiWiki
parent51cd34afff17f27cdcdf45a1e9c4ce047a2eef80 (diff)
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.
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/git.pm6
1 files changed, 6 insertions, 0 deletions
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, $_;
}