Permalink
Browse files

Fix #1938

Where the email library removed multiple spaces inside a plain text message.

Signed-off-by: GDmac <grdalenoort@gmail.com>
  • Loading branch information...
1 parent 51b7acd commit 9bea4be2efa74b963d3cd0bbaa4635deffc2f109 @GDmac GDmac committed Oct 30, 2012
Showing with 6 additions and 3 deletions.
  1. +6 −3 system/libraries/Email.php
@@ -770,6 +770,9 @@ protected function _get_alt_message()
$body = str_replace(str_repeat("\n", $i), "\n\n", $body);
}
+ // Reduce multiple spaces
+ $str = preg_replace('| +|', ' ', $str);
+
return ($this->wordwrap)
? $this->word_wrap($body, 76)
: $body;
@@ -792,15 +795,15 @@ public function word_wrap($str, $charlim = NULL)
$charlim = empty($this->wrapchars) ? 76 : $this->wrapchars;
}
- // Reduce multiple spaces
- $str = preg_replace('| +|', ' ', $str);
-
// Standardize newlines
if (strpos($str, "\r") !== FALSE)
{
$str = str_replace(array("\r\n", "\r"), "\n", $str);
}
+ // Reduce multiple spaces at end of line
+ $str = preg_replace('| +\n|', "\n", $str);
+
// If the current word is surrounded by {unwrap} tags we'll
// strip the entire chunk and replace it with a marker.
$unwrap = array();

0 comments on commit 9bea4be

Please sign in to comment.