http://qs1969.pair.com?node_id=11134694

Arik123 has asked for the wisdom of the Perl Monks concerning the following question:

I'm parsing a multipart MIME email, which contains the line:

Content-Type: image/png; name="=?UTF-8?B?15DXmdeZ15PXmSDXqNeWLnBuZw==?="

My code contains:

$email = Email::MIME->new (\$msg); $email->walk_parts( sub { return if $_[0]->subparts; print $_[0]->filename; } );

This produces the following warning:

Unquoted '"' not allowed at ./em_try.pl line 21. Missing semicolon before parameter '"אייד&#149 +7; רז.png"' at ./em_try.pl line 21.

I think it happens only on utf8 filenames, and I think it's a bug. What do you think?

Replies are listed 'Best First'.
Re: Email::MIME bug?
by hippo (Bishop) on Jul 06, 2021 at 09:58 UTC

    Sounds like this. Maybe look at the mentioned PRs?


    🦛

      Not exactly. His problem arised at new(), and my problem arised at filename(). My call to new() went without a problem, as my Email::MIME already contained his patch.

      However, following his example, I patched the filename() method, and my problem vanished. I changed

       my $dis = $self->header("Content-Disposition") || '';

      to:

       my $dis = $self->header_raw("Content-Disposition") || '';

      In my Email::MIME, it's in line 453.