summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-03-09 14:18:55 -0400
committerJoey Hess <joey@gnu.kitenet.net>2009-03-09 14:18:55 -0400
commit4ac0b2953131d7a53562ab8918c8e5a49952d8ac (patch)
tree21b0d12ca70dcec6126f4bd591d9311795e77316
parent7bd0d536442493a8898981a8a784bf16126085c5 (diff)
git: Manually decode git output from utf-8, avoids warning messages on invalidly encoded output.
-rw-r--r--IkiWiki/Plugin/git.pm12
-rw-r--r--debian/changelog2
2 files changed, 9 insertions, 5 deletions
diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm
index 12f3a74cb..b386ab71b 100644
--- a/IkiWiki/Plugin/git.pm
+++ b/IkiWiki/Plugin/git.pm
@@ -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, $_;
}
diff --git a/debian/changelog b/debian/changelog
index a7e7544c6..77b5d9fa6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,8 @@
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