gitweb: Convert string to internal form before chopping in chop_str
commitdee2775a29440ca8a52bb5bd09a6de6cd29f69cc
authorAnders Waldenborg <anders@0x63.nu>
Wed, 21 May 2008 11:44:43 +0000 (21 13:44 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 23 May 2008 06:03:43 +0000 (22 23:03 -0700)
tree737d3be88d037168e438763fdf6f3d52e58fab93
parent1af8bca79766198c591d8db58f778a98e96627e2
gitweb: Convert string to internal form before chopping in chop_str

Fix chop_str not to cut in middle of utf8 multibyte chars. Without
this fix at least author name in short log may cut in middle of a
multibyte char. When the result comes to esc_html to_utf8 is called
again, which doesn't find valid utf8 and decodes using
$fallback_encoding making it even worse.

This also have the nice side effect that it actually tries to show the
first 10 _characters_, not the number of characters that happened to fit
into 10 bytes.

Signed-off-by: Anders Waldenborg <anders@0x63.nu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
gitweb/gitweb.perl