projects
/
mmh
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
02c7618
)
Sigh. More corner cases to deal with!
author
Ken Hornstein
<kenh@pobox.com>
Thu, 5 Apr 2012 03:33:40 +0000
(23:33 -0400)
committer
Ken Hornstein
<kenh@pobox.com>
Thu, 5 Apr 2012 03:34:03 +0000
(23:34 -0400)
docs/contrib/replyfilter
patch
|
blob
|
history
diff --git
a/docs/contrib/replyfilter
b/docs/contrib/replyfilter
index
b74465a
..
36facd5
100755
(executable)
--- a/
docs/contrib/replyfilter
+++ b/
docs/contrib/replyfilter
@@
-168,6
+168,7
@@
sub process_text (*$$;$)
while (<$input>) {
$ret = match_boundary($_, $boundary);
if (defined $ret) {
while (<$input>) {
$ret = match_boundary($_, $boundary);
if (defined $ret) {
+ binmode($input, ':encoding(us-ascii)');
return $ret;
}
print $quoteprefix, $_;
return $ret;
}
print $quoteprefix, $_;
@@
-179,7
+180,7
@@
sub process_text (*$$;$)
# certainly US-ASCII
#
# certainly US-ASCII
#
- binmode($input, ":encoding(us-ascii)");
+ binmode($input, ':encoding(us-ascii)');
$decoder = find_decoder($encoding);
if (! defined $decoder) {
$decoder = find_decoder($encoding);
if (! defined $decoder) {
@@
-195,22
+196,28
@@
sub process_text (*$$;$)
my $chardecode = find_encoding($charset);
while (<$input>) {
my $chardecode = find_encoding($charset);
while (<$input>) {
- my $line, $len;
+ my @lines, $len;
last if ($ret = match_boundary($_, $boundary));
last if ($ret = match_boundary($_, $boundary));
- $line = $chardecode->decode(&$decoder($_));
+ @lines = split(/^/, $chardecode->decode(&$decoder($_)));
if (substr($text[$#text], -1, 1) eq "\n") {
if (substr($text[$#text], -1, 1) eq "\n") {
- push @text, $line;
+ push @text, shift @lines;
} else {
} else {
- $text[$#text] .= $line;
+ $text[$#text] .= shift @lines;
}
if (($len = length($text[$#text])) > $maxline) {
$maxline = $len;
}
}
if (($len = length($text[$#text])) > $maxline) {
$maxline = $len;
}
+
+ if ($#lines > -1) {
+ push @text, @lines;
+ }
}
}
+ binmode($input, ':encoding(us-ascii)');
+
if (! defined $ret) {
$ret = 'EOF';
}
if (! defined $ret) {
$ret = 'EOF';
}
@@
-219,7
+226,9
@@
sub process_text (*$$;$)
#
# These are short enough; just output it now as-is
#
#
# These are short enough; just output it now as-is
#
- print STDOUT @text;
+ foreach my $line (@text) {
+ print STDOUT $quoteprefix, $line;
+ }
return $ret;
}
return $ret;
}
@@
-641,6
+650,8
@@
sub match_boundary($$)
{
my ($_, $boundary) = @_;
{
my ($_, $boundary) = @_;
+ return if ! defined $boundary;
+
if (substr($_, 0, 2) eq '--') {
s/[ \t\r\n]+\Z//;
if ($_ eq "--$boundary") {
if (substr($_, 0, 2) eq '--') {
s/[ \t\r\n]+\Z//;
if ($_ eq "--$boundary") {