On Mon, Jan 28, 2002 at 10:11:05PM +0200, Richard ??epas wrote:
>        Yes, encode_mimewords can output more then one encoded word, length 
>        of each one depends on encoding & other circumstances but should not 
>        exceed 78 bytes in the worst case.

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.

Rich.

-- 
[EMAIL PROTECTED] | Is your school part of http://www.schoolmaster.net ?
BiblioTech Ltd, Unit 2 Piper Centre, 50 Carnwath Road, London, SW6 3EG.
+44 20 7384 6917 | Free software: http://freshmeat.net/users/rwmj
Copyright � 2002 Richard Jones | GnuPG/PGP key from www.annexia.org
--
Linux-UTF8:   i18n of Linux on all levels
Archive:      http://mail.nl.linux.org/linux-utf8/

Reply via email to