[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need some help with Rmail/mbox

From: Eli Zaretskii
Subject: Re: Need some help with Rmail/mbox
Date: Fri, 19 Sep 2008 12:12:48 +0300

> Date: Thu, 18 Sep 2008 12:02:19 -0400
> From: Paul Michael Reilly <address@hidden>
> The basic problem I need to solve now is how to map the values of the
> content-type and content-transfer-encoding headers (either of which
> could legally be absent) to an Emacs coding system.  I am slogging
> through this task and if anyone has already done it and has either a
> short "how-to" or even better some code, that would be much
> appreciated.
> As Eli helpfully pointed out, rmail-convert-to-babyl-format provides
> some help.

Yes, and it already maps the values of content-transfer-encoding into
Emacs coding-systems (the mapping is trivial, btw; see
rmail-decode-region and its callers).  If you still have problems with
this after reading the Rmail code, please ask more specific questions.

> As near as I can tell the task is to decode the message body in two
> steps: first to decode according to the character encoding
> (e.g. quoted-printable or base64) and then to decode that result to
> some coding system.  Something along the lines of:
>      (let (body)
>        (setq body (apply qp or base64 to body of message)
>        (decode-coding-string body (detect-coding-string body t))
> Am I even in the ballpark?

Yes, this is exactly what rmail-convert-to-babyl-format does.  It just
assumes that there's only one part in the message, so it does the
above only once.  You want to do that for every part of a multi-part

reply via email to

[Prev in Thread] Current Thread [Next in Thread]