From d310864281599056622b409e0dcea084c20e8682 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Wed, 19 Dec 2007 03:22:43 +0000 Subject: Bug 405444: FormatDouble and FormatTriple mangle multi-byte strings in email Patch By Max Kanat-Alexander r=himorin, a=mkanat --- Bugzilla/Util.pm | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'Bugzilla/Util.pm') 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 + +Wraps a string, so that a line is I longer than C<$size>. +Returns the string, wrapped. + =item C Takes a bug comment, and wraps it to the appropriate length. The length is -- cgit v1.2.3-24-g4f1b