Re: [PATCH] gitweb: use decode_utf8 directly
- From
Junio C Hamano <junkio@cox.net>
- Date
- May 1, 2007, 21:39 UTC
- Message-ID
- <7v8xc85ill.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <200705020012.13302.ismail@pardus.org.tr>
Ismail Dönmez <ismail@pardus.org.tr> writes:
Show 13 quoted lines
> Ok found out the reason. decode() tries to decode data that is already UTF-8
> and borks.
>
> This is from Encode.pm :
>
> sub decode_utf8($;$) {
> my ( $str, $check ) = @_;
> return $str if is_utf8($str); <--- Checks if the $str is already UTF-8
> if ($check) {
> return decode( "utf8", $str, $check ); <--- Else do what gitweb does
> [...]
>
> So my patch is indeed correct.Ok, I think that makes it an improvement from the current code, so I'd apply.
But at the same time I wonder why should the callers be feeding an already decoded string to to_utf8(). It might be that some callers needs fixing.