Jason R. Mastaler <[EMAIL PROTECTED]> writes:

> I could add a `HeaderCharset:' field to allow the user to specify a
> different charset for headers than is used for the body, but I don't
> see an easy way to allow multiple charsets within the headers.

What about something weird like this (this is the template):

    From.US-ASCII: "%(FULLNAME)s" <%(recipient_address)s>
    Subject.EUC-JP: Please confirm your message
    Charset: EUC-JP

So, if you want to encode the header, you append '.<charset>' to the
header name.  If you want to leave it in ASCII, just leave the header
plain.  The Charset pseudo-header affects the body, as before.

This is pretty easy to parse (string between last dot and colon, then
look it up in the table of known charsets).  Invalid charsets are
assumed to be part of the field name and the field name is left alone.

It's not the prettiest thing, but it works.  Or rather, I think it
works, if there's a way to verify that the charset specified is valid.
Perhaps just attempting to encode the header with that charset and
catching any exceptions is good enough.


Tim
_________________________________________________
tmda-workers mailing list ([EMAIL PROTECTED])
http://tmda.net/lists/listinfo/tmda-workers

Reply via email to