diff options
author | Eric Wong <e@80x24.org> | 2019-10-31 00:33:04 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-10-31 00:33:50 +0000 |
commit | 130af18f06ae9b91e07985ff56b4dd90cedbd744 (patch) | |
tree | 8b26f39c874649ccc9d9746410f13c7222b5212b /t/msg_iter.t | |
parent | 7375e589c165cd0c5bae2d70ff8e279fb76216a2 (diff) | |
download | public-inbox-130af18f06ae9b91e07985ff56b4dd90cedbd744.tar.gz |
msgiter: do not assume UTF-8 if Email::MIME->body_str succeeds
ISO-2202-JP and other non-UTF-8 messages need to be displayed correctly. Fixes: 7d82a8bc04ce ('handle "multipart/mixed" messages which are not multipart')
Diffstat (limited to 't/msg_iter.t')
-rw-r--r-- | t/msg_iter.t | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/t/msg_iter.t b/t/msg_iter.t index f6fd3bb0..f9b586f1 100644 --- a/t/msg_iter.t +++ b/t/msg_iter.t @@ -40,5 +40,23 @@ use_ok('PublicInbox::MsgIter'); 'nested part shows up properly'); } +{ + my $f = 't/iso-2202-jp.mbox'; + my $mime = Email::MIME->new(do { + open my $fh, '<', $f or die "open($f): $!"; + local $/; + <$fh>; + }); + my $raw = ''; + msg_iter($mime, sub { + my ($part, $level, @ex) = @{$_[0]}; + my ($s, $err) = msg_part_text($part, 'text/plain'); + ok(!$err, 'no error'); + $raw .= $s; + }); + ok(length($raw) > 0, 'got non-empty message'); + is(index($raw, '$$$'), -1, 'no unescaped $$$'); +} + done_testing(); 1; |