Subject: | Automatic support MIME-Header decode |
See other ticket: in my real-life code, I see a complication which we can take out of the hands of a end-user.
The message headers are encoded. This can be really complex (I have implemented encoding and decoding for Mail::Box). To handle the headers correctly, you are currently obliged to do this:
my $from = decode('MIME-Header', $imap->get_header($msgnr, "From"));
my $subject = decode('MIME-Header', $imap->subject($msgnr));
Could we add '$imap->decode_header($msgnr, $field)' like this:
sub decode_header($$) {
my ($self, $msgnr, $field) = @_;
my $header = $self->get_header($msgnr, $field);
defined $header ? decode('MIME-Header', $header) : undef;
}