提交 e5d3de5c 编写于 作者: İ İsmail Dönmez 提交者: Junio C Hamano

gitweb: use Perl built-in utf8 function for UTF-8 decoding.

Signed-off-by: Nİsmail Dönmez <ismail@pardus.org.tr>
Tested-by: NMartin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 dcbcb707
......@@ -695,10 +695,9 @@ sub validate_refname {
# in utf-8 thanks to "binmode STDOUT, ':utf8'" at beginning
sub to_utf8 {
my $str = shift;
my $res;
eval { $res = decode_utf8($str, Encode::FB_CROAK); };
if (defined $res) {
return $res;
if (utf8::valid($str)) {
utf8::decode($str);
return $str;
} else {
return decode($fallback_encoding, $str, Encode::FB_DEFAULT);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册