--- lib/Mail/SpamAssassin/Message.pm Thu Apr 27 15:42:02 2006 +++ lib/Mail/SpamAssassin/Message.pm Thu Apr 27 15:53:53 2006 @@ -878,8 +879,19 @@ } } + # If the number of double newlines exceeds the number of single + # newlines we have a special formatted mail with a newline between + # each line. Only convert double newlines if this isn't the case. + # + my @dl = ($text =~ /([^\n]\n+\s*\n+[^\n])/g); + my $dl_count = @dl; + my @ol = ($text =~ /([^\n]\n[^\n])/g); + my $ol_count = @ol; + if ($dl_count < $ol_count) { + $text =~ s/\n+\s*\n+/\f/gs; # double newline => form feed + } + # whitespace handling (warning: small changes have large effects!) - $text =~ s/\n+\s*\n+/\f/gs; # double newlines => form feed $text =~ tr/ \t\n\r\x0b\xa0/ /s; # whitespace => space $text =~ tr/\f/\n/; # form feeds => newline