From: Ailin Nemui Date: Sat, 3 Feb 2018 19:34:24 +0000 (+0100) Subject: fix legacy encodings X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=828a949323ab6bfd24fd9a97b719a958e1066fc3;p=irssi-scripts.irssi.org.git fix legacy encodings --- diff --git a/scripts/trackbar.pl b/scripts/trackbar.pl index 95d6a35..2537db0 100644 --- a/scripts/trackbar.pl +++ b/scripts/trackbar.pl @@ -362,9 +362,7 @@ sub screen_length; else { *screen_length = sub { my $temp = shift; - if (is_utf8()) { - Encode::_utf8_on($temp); - } + Encode::_utf8_on($temp) if is_utf8(); length($temp) }; } @@ -388,7 +386,7 @@ sub line { $string = ' ' unless length $string; $time ||= time; - Encode::_utf8_on($string); + Encode::_utf8_on($string) if is_utf8(); my $length = c_length($string); my $format = ''; @@ -402,7 +400,9 @@ sub line { my $times = $width / $length; $times += 1 if $times != int $times; - $format .= $config{style}; + my $style = "$config{style}"; + Encode::_utf8_on($style) if is_utf8(); + $format .= $style; $width -= c_length($format); $string x= $times; chop $string while length $string && c_length($string) > $width;