]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/git.pm
github error and comment
[git.ikiwiki.info.git] / IkiWiki / Plugin / git.pm
index 12f3a74cb7a11178b29fae3300f9e84db76c07b7..b386ab71bfa6b0d0feffcb53fb167f17c1ac016d 100644 (file)
@@ -136,14 +136,16 @@ sub safe_git (&@) {
        }
        # 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>) {
+               $_=decode_utf8($_, 0);
+
                chomp;
-               
-               # check for invalid utf-8, and toss it back to avoid crashes
-               if (! utf8::valid($_)) {
-                       $_=encode_utf8($_);
-               }
 
                push @lines, $_;
        }