]> sipb.mit.edu Git - ikiwiki.git/commitdiff
git: Manually decode git output from utf-8, avoids warning messages on invalidly...
authorJoey Hess <joey@gnu.kitenet.net>
Mon, 9 Mar 2009 18:18:55 +0000 (14:18 -0400)
committerJoey Hess <joey@gnu.kitenet.net>
Mon, 9 Mar 2009 18:18:55 +0000 (14:18 -0400)
IkiWiki/Plugin/git.pm
debian/changelog

index 12f3a74cb7a11178b29fae3300f9e84db76c07b7..b386ab71bfa6b0d0feffcb53fb167f17c1ac016d 100644 (file)
@@ -136,14 +136,16 @@ sub safe_git (&@) {
        }
        # In parent.
 
        }
        # In parent.
 
+       # git output is probably utf-8 encoded, but may contain
+       # other encodings or invalidly encoded stuff. So do not rely
+       # on the normal utf-8 IO layer, decode it by hand.
+       binmode($OUT);
+
        my @lines;
        while (<$OUT>) {
        my @lines;
        while (<$OUT>) {
+               $_=decode_utf8($_, 0);
+
                chomp;
                chomp;
-               
-               # check for invalid utf-8, and toss it back to avoid crashes
-               if (! utf8::valid($_)) {
-                       $_=encode_utf8($_);
-               }
 
                push @lines, $_;
        }
 
                push @lines, $_;
        }
index a7e7544c6cf0a68af1cf2e603bbc0753a1c36204..77b5d9fa6acc705d51bdc20da215dccd896b4caf 100644 (file)
@@ -1,6 +1,8 @@
 ikiwiki (3.08) UNRELEASED; urgency=low
 
   * git: Fix utf-8 encoding of author names.
 ikiwiki (3.08) UNRELEASED; urgency=low
 
   * git: Fix utf-8 encoding of author names.
+  * git: Manually decode git output from utf-8, avoids
+    warning messages on invalidly encoded output.
 
  -- Joey Hess <joeyh@debian.org>  Mon, 09 Mar 2009 14:00:21 -0400
 
 
  -- Joey Hess <joeyh@debian.org>  Mon, 09 Mar 2009 14:00:21 -0400