Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *{AnyEvent::IRC::Util::split_unicode_string} = sub {
- my ($enc, $str, $maxlen) = @_;
- return $str unless length (encode ($enc, $str)) > $maxlen;
- my $cur_out = '';
- my $word = '';
- my @lines;
- while (length ($str) > 0) {
- $word .= substr $str, 0, 1, '';
- if ($word =~ /\w\W$/ || length ($str) == 0) {
- if (length (encode ($enc, $cur_out.$word)) > $maxlen) {
- push @lines, $cur_out;
- $cur_out = '';
- }
- $cur_out .= $word;
- $word = '';
- }
- }
- push @lines, $cur_out if length ($cur_out);
- };
Add Comment
Please, Sign In to add comment