Automatic content-type insertion

Lawrence Greenfield leg+ at
Thu Dec 26 00:04:21 EST 2002

--On Monday, December 02, 2002 10:43 AM +1100 Rob Mueller 
<robm at> wrote:

> I'm just wondering why cyrus automatically adds a content type charset to
> every message, even if none is specified in the message itself. For
> example:
> So there's no "Content-Type" line in the message, but the bodystructure
> has given it an implicit charset of us-ascii. Now, I know that this is
> technically true, but unfortunately, there seem to be quite a few broken
> iso-2022-jp messages out there which don't actually specify the charset in
> the header. What we allow on our site is a 'default charset', which is
> used if no charset is available, which would work fine in this situation.
> Unfortunately in this case, there's no indication that the ("CHARSET"
> "us-ascii") response was auto-generated, rather than explicitly set.

It does this because that's what the IMAP spec says to do. Section 7.4.2:

>          A parenthesized list that describes the [MIME-IMB] body
>          structure of a message.  This is computed by the server by
>          parsing the [MIME-IMB] header fields, defaulting various fields
>          as necessary.

> The main solutions I see are:
> 1. Remove the implicit setting of the charset if none supplied

It appears that this would conflict with the RFC.

> 2. us-ascii is a subset of most encodings anyway, so always allow
> overriding of a us-ascii charset anyway

This is probably reasonable, especially if your allowable "default 
encodings" are all supersets of US-ASCII.

> 3. Do a fetch body[header.fields (Content-Type)] to see if one actually
> exists

This seems more annoying and I suspect it's not particularly fast on Cyrus.


More information about the Info-cyrus mailing list