git: Manually decode git output from utf-8, avoids warning messages on invalidly encoded output.
parent
7bd0d53644
commit
4ac0b29531
|
@ -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;
|
my @lines;
|
||||||
while (<$OUT>) {
|
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, $_;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
ikiwiki (3.08) UNRELEASED; urgency=low
|
ikiwiki (3.08) UNRELEASED; urgency=low
|
||||||
|
|
||||||
* git: Fix utf-8 encoding of author names.
|
* 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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue