]> sipb.mit.edu Git - ikiwiki.git/commitdiff
git: Fix malformed utf8 recieved from git.
authorJoey Hess <joey@gnu.kitenet.net>
Mon, 26 Jan 2009 04:13:14 +0000 (23:13 -0500)
committerJoey Hess <joey@gnu.kitenet.net>
Mon, 26 Jan 2009 04:13:14 +0000 (23:13 -0500)
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
debian/changelog

index 3085a3b6711da7d9a2991837820664b108630569..042c69f5a043699ff275f4acb7433a9482a366c8 100644 (file)
@@ -139,6 +139,12 @@ sub safe_git (&@) {
        my @lines;
        while (<$OUT>) {
                chomp;
        my @lines;
        while (<$OUT>) {
                chomp;
+               
+               # check for invalid utf-8, and toss it back to avoid crashes
+               if (! utf8::valid($_)) {
+                       $_=encode_utf8($_);
+               }
+
                push @lines, $_;
        }
 
                push @lines, $_;
        }
 
index c9ebcd1e995d69a566384cb148ab1a07d39e14ec..6c1710fe10b89b1499b2b3d31b8fb6925ace4980 100644 (file)
@@ -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.
   * 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 <joeyh@debian.org>  Sun, 18 Jan 2009 14:50:57 -0500
 
 
  -- Joey Hess <joeyh@debian.org>  Sun, 18 Jan 2009 14:50:57 -0500