I'm just struggling slightly to work out how you're meant to handle the
following situation. It seems a bit inconsistent, so I want to check I'm
interpreting it right.
If I have a header
Subject: hello
there
(no space after 'hello' and one space before 'there')
I should unwrap that to
Subject: hello there
(one space between 'hello' and 'there' - ie just remove the CRLF as
stated in RFC 2822 2.2.3)
Yes?
----
If I have a header
Subject: =?us-ascii?Q?hello?= =?us-ascii?Q?there?=
(two encoded words with no spaces in them, and a space between them) I
should decode that to
Subject: hello there
Yes?
(to be honest, I'm not entirely sure about this because 'Subject:
=?us-ascii?Q?hello?=there' (without a space) is illegal, so if you
wanted that would you use 'Subject: =?us-ascii?Q?hello?= there' instead
and expect the space to be stripped out or can you just not do it -
section 5(1) of RFC 2047 isn't clear whether the separating LWS is
retained or not)
----
If I have a header
Subject: =?us-ascii?Q?hello?=
=?us-ascii?Q?there?=
(no space after the encoded 'hello' and one space before the encoded
'there')
As I read it, I should decode it to
Subject: hellothere
i.e. in this case I should discard the CRLF *and* the space, so I can't
just unwrap it, and then decode as the space would be kept then.
Yes?
----
If so, what about
Subject: hello
=?us-ascii?Q?there?=
or
Subject: =?us-ascii?Q?hello?=
there
Do I keep the space after the CRLF in these situations or not?
RFC 2047 seems to ignore this little side effect of header folding,
although it says that wrapping should be used to make sure that no
encoded-word is longer than 76 characters.
--
Paul Smith
VPOP3 - POP3/SMTP/IMAP4/Webmail Email server for Windows