diff options
author | mkanat%bugzilla.org <> | 2007-12-19 04:22:43 +0100 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2007-12-19 04:22:43 +0100 |
commit | d310864281599056622b409e0dcea084c20e8682 (patch) | |
tree | 59b6f26a245c6fd0a28c3d5082b939cf33df99a5 /Bugzilla/Util.pm | |
parent | 2fe815e9b6168dc98f37ba03f51c76206ae7fccc (diff) | |
download | bugzilla-d310864281599056622b409e0dcea084c20e8682.tar.gz bugzilla-d310864281599056622b409e0dcea084c20e8682.tar.xz |
Bug 405444: FormatDouble and FormatTriple mangle multi-byte strings in email
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=himorin, a=mkanat
Diffstat (limited to 'Bugzilla/Util.pm')
-rw-r--r-- | Bugzilla/Util.pm | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm index aad2c5672..4d702f02e 100644 --- a/Bugzilla/Util.pm +++ b/Bugzilla/Util.pm @@ -38,7 +38,7 @@ use base qw(Exporter); i_am_cgi get_netaddr correct_urlbase lsearch diff_arrays diff_strings - trim wrap_comment find_wrap_point + trim wrap_hard wrap_comment find_wrap_point format_time format_time_decimal validate_date validate_time file_mod_time is_7bit_clean @@ -339,6 +339,17 @@ sub find_wrap_point { return $wrappoint; } +sub wrap_hard { + my ($string, $columns) = @_; + local $Text::Wrap::columns = $columns; + local $Text::Wrap::unexpand = 0; + local $Text::Wrap::huge = 'wrap'; + + my $wrapped = wrap('', '', $string); + chomp($wrapped); + return $wrapped; +} + sub format_time { my ($date, $format) = @_; @@ -739,6 +750,11 @@ compared to the old one. Returns a list, where the first entry is a scalar containing removed items, and the second entry is a scalar containing added items. +=item C<wrap_hard($string, $size)> + +Wraps a string, so that a line is I<never> longer than C<$size>. +Returns the string, wrapped. + =item C<wrap_comment($comment)> Takes a bug comment, and wraps it to the appropriate length. The length is |