]> Lady’s Gitweb - Gitweb/blobdiff - gitweb.perl
gitweb: Convert string to internal form before chopping in chop_str
[Gitweb] / gitweb.perl
index 986c9ed2ec0852807528cbb604d281cf07fcbd31119b9844e64311c1bfa89b01..d3950f53c13812ef0cd8a4bfdc7630ce33a87fff13b2980caa9f3080ea2c5d55 100755 (executable)
@@ -867,6 +867,10 @@ sub chop_str {
        my $add_len = shift || 10;
        my $where = shift || 'right'; # 'left' | 'center' | 'right'
 
+       # Make sure perl knows it is utf8 encoded so we don't
+       # cut in the middle of a utf8 multibyte char.
+       $str = to_utf8($str);
+
        # allow only $len chars, but don't cut a word if it would fit in $add_len
        # if it doesn't fit, cut it if it's still longer than the dots we would add
        # remove chopped character entities entirely
This page took 0.232481 seconds and 4 git commands to generate.