projects
/
mmh
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
644f47c
)
Fixed some more charset/encoding stuff.
author
Ken Hornstein
<kenh@pobox.com>
Wed, 4 Apr 2012 19:55:36 +0000
(15:55 -0400)
committer
Ken Hornstein
<kenh@pobox.com>
Wed, 4 Apr 2012 19:55:36 +0000
(15:55 -0400)
docs/contrib/replyfilter
patch
|
blob
|
history
diff --git
a/docs/contrib/replyfilter
b/docs/contrib/replyfilter
index
193dd40
..
b74465a
100755
(executable)
--- a/
docs/contrib/replyfilter
+++ b/
docs/contrib/replyfilter
@@
-160,6
+160,11
@@
sub process_text (*$$;$)
#
if ($encoding eq '7bit' || $encoding eq '8bit') {
#
if ($encoding eq '7bit' || $encoding eq '8bit') {
+ #
+ # Switch the character set to whatever is specified by
+ # the MIME message
+ #
+ binmode($input, ":encoding($charset)");
while (<$input>) {
$ret = match_boundary($_, $boundary);
if (defined $ret) {
while (<$input>) {
$ret = match_boundary($_, $boundary);
if (defined $ret) {
@@
-169,6
+174,13
@@
sub process_text (*$$;$)
}
return 'EOF';
} else {
}
return 'EOF';
} else {
+ #
+ # If we've got some other encoding, the input text is almost
+ # certainly US-ASCII
+ #
+
+ binmode($input, ":encoding(us-ascii)");
+
$decoder = find_decoder($encoding);
if (! defined $decoder) {
return 'EOF';
$decoder = find_decoder($encoding);
if (! defined $decoder) {
return 'EOF';
@@
-180,12
+192,14
@@
sub process_text (*$$;$)
# to filter it. Read it in; if it's too long, filter it.
#
# to filter it. Read it in; if it's too long, filter it.
#
+ my $chardecode = find_encoding($charset);
+
while (<$input>) {
my $line, $len;
last if ($ret = match_boundary($_, $boundary));
while (<$input>) {
my $line, $len;
last if ($ret = match_boundary($_, $boundary));
- $line = decode($charset, &$decoder($_));
+ $line = $chardecode->decode(&$decoder($_));
if (substr($text[$#text], -1, 1) eq "\n") {
push @text, $line;
if (substr($text[$#text], -1, 1) eq "\n") {
push @text, $line;