Subject: | MIME::Words::encode_mimewords includes spaces in the encoded word |
Date: | Fri, 7 Oct 2016 18:25:50 +0200 |
To: | <bug-MIME-tools [...] rt.cpan.org> |
From: | Moritz Lenz <moritz.lenz [...] noris.de> |
Dear maintainer,
this small program:
$ cat mimewords.pl
use utf8;
use 5.022;
use warnings;
use MIME::Words qw(encode_mimewords);
say encode_mimewords('Moritz Bößl <foo@example.com>');
produces as output:
$ perl noris/mimewords.pl
Moritz =?ISO-8859-1?Q?B=F6=DFl=20?=<foo@example.com>
The space between the second word and the less-than sign has been
encoded. The expected output is:
Moritz =?iso-8859-1?Q?B=F6=DFl?= <foo@example.com>
RFC2047 says:
(3) As a replacement for a 'word' entity within a 'phrase', for example,
one that precedes an address in a From, To, or Cc header. The ABNF
definition for 'phrase' from RFC 822 thus becomes:
phrase = 1*( encoded-word / word )
In this case the set of characters that may be used in a "Q"-encoded
'encoded-word' is restricted to: <upper and lower case ASCII
letters, decimal digits, "!", "*", "+", "-", "/", "=", and "_"
(underscore, ASCII 95.)>. An 'encoded-word' that appears within a
'phrase' MUST be separated from any adjacent 'word', 'text' or
'special' by 'linear-white-space'.
In the output, the encoded word isn't separated from the "special"
less-than sign by a linear-white-space.
I've tested this with version 5.508 of MIME-tools.
Best regards,
Moritz Lenz
Message body not shown because it is not plain text.