[EMAIL PROTECTED] <[EMAIL PROTECTED]>:
> A slight extra problem is that MIME::Words and Mail::Header
> don't really get along very well together.
>
> It seems that Mail::Header splits up some headers differently
> from others. If the header is mentioned in the magical internal
> hash %Mail::Header::STRUCTURE, then the header is split up on
> whitespace, commas and semi-colons, eg:
>
> From: =?utf-8?Q?Richard Jones?=
> <[EMAIL PROTECTED]>
>
> But otherwise (eg. for Subject headers), Mail::Header will split
> at an arbitrary location based on length only. This has the effect
> of splitting the "word" across lines, which breaks things.
>
> Unfortunately adding %Mail::Header::STRUCTURE{subject} doesn't
> seem to be the answer, because I can't necessarily guarantee
> that the subject line will contain any whitespace. So it looks
> like I'll have to break the header up by hand by adding \n
> after "words" before calling MIME::Entity->build.
>
> I'm sure I can't be the first person to find this problem ...
>
> I'm also not sure why the RFC doesn't define that headers should
> be concatenated *first*, followed *second* by un-mimeifying. That
> would seem to be a much simpler way of doing things.
Because in general you don't want to unfold (concatenate) header
fields.
I don't think Mail::Header should be folding (splitting up) headers at
all.
RFC 822 merely says you can fold header lines, not that you should. In
the case of an unstructured field, such as Subject, splitting up and
concatenating the header may destroy deliberate layout, for example:
Subject: Awake! for Morning in the Bowl of Night
Has flung the Stone that puts the Stars to Flight
Obviously an MTA may want to unfold the text in order to display it in
a summary list, but I don't see why Mail::Header has to mess with it.
So, I suggest you try complaining to the maintainer of Mail::Header.
Perhaps they would be willing to only split up structured header
lines, for example.
Edmund
--
Linux-UTF8: i18n of Linux on all levels
Archive: http://mail.nl.linux.org/linux-utf8/