line wrap with encode('MIME-Header', "foo")

A

Axel Hanusch

Hi,
when I do this

use Encode "encode";
print encode('MIME-Header', 'Subject: blah blah blah blah blah blah \
blah blah blah blah blah (e-mail address removed) blah')."\r\n";

I get this result:

Subject: blah blah blah blah blah blah blah blah blah blah blah foo@bar.
org blah

The line is folded after the '.' and when the receiving email client
unfolds it according to RFC 822 (Section 3.1.1.), the result is "...blah
foo@bar. org blah" instead of "...blah (e-mail address removed) blah".

Why are lines folded at characters like ()<>@,;:"'/[]?.= and not at
whitespaces?


Thanks in advance,

Axel
 
B

Bill

Axel said:
Hi,
when I do this

use Encode "encode";
print encode('MIME-Header', 'Subject: blah blah blah blah blah blah \
blah blah blah blah blah (e-mail address removed) blah')."\r\n";

I get this result:

Subject: blah blah blah blah blah blah blah blah blah blah blah foo@bar.
org blah

The line is folded after the '.' and when the receiving email client
unfolds it according to RFC 822 (Section 3.1.1.), the result is "...blah
foo@bar. org blah" instead of "...blah (e-mail address removed) blah".

Why are lines folded at characters like ()<>@,;:"'/[]?.= and not at
whitespaces?

Maybe a bug, but long subject lines should be encoded in chunks anyway.
See the example specs for MIME-Header in the RFC.
Thanks in advance,

Axel
RFC 2047:

(=?ISO-8859-1?Q?a?= (ab)
=?ISO-8859-1?Q?b?=)

Any amount of linear-space-white between 'encoded-word's,
even if it includes a CRLF followed by one or more SPACEs,
is ignored for the purposes of display.

Perhaps you might try splitting a long subject line yourself and encode
the pieces?

--HTH
 
A

Axel Hanusch

OK, this works better now. I split at whitespaces and encode the words.
With one exception. RFC 2047 says in section 6.2:

When displaying a particular header field that contains multiple
'encoded-word's, any 'linear-white-space' that separates a pair of
adjacent 'encoded-word's is ignored. (This is to allow the use of
multiple 'encoded-word's to represent long strings of unencoded text,
without having to separate 'encoded-word's where spaces occur in the
unencoded text.)

So, I treat words that need to be encoded (containing 8-Bit chars
instead of only 7 Bit) and appear in pairs, as one word.

Regards

Axel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top