From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Need some help with Rmail/mbox Date: Fri, 19 Sep 2008 12:12:48 +0300 Message-ID: References: Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1221815662 19531 80.91.229.12 (19 Sep 2008 09:14:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 19 Sep 2008 09:14:22 +0000 (UTC) Cc: emacs-devel@gnu.org To: pmr@pajato.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 19 11:15:19 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Kgc4r-0001Be-TS for ged-emacs-devel@m.gmane.org; Fri, 19 Sep 2008 11:15:02 +0200 Original-Received: from localhost ([127.0.0.1]:41562 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kgc3q-0005lW-1G for ged-emacs-devel@m.gmane.org; Fri, 19 Sep 2008 05:13:58 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kgc3T-0005kX-Oj for emacs-devel@gnu.org; Fri, 19 Sep 2008 05:13:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kgc3Q-0005jn-RM for emacs-devel@gnu.org; Fri, 19 Sep 2008 05:13:33 -0400 Original-Received: from [199.232.76.173] (port=44630 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kgc3Q-0005jc-8h for emacs-devel@gnu.org; Fri, 19 Sep 2008 05:13:32 -0400 Original-Received: from mtaout7.012.net.il ([84.95.2.19]:64341) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Kgc3P-00076c-Gd for emacs-devel@gnu.org; Fri, 19 Sep 2008 05:13:31 -0400 Original-Received: from HOME-C4E4A596F7 ([77.127.116.246]) by i-mtaout7.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0K7F00IZFQYXS490@i-mtaout7.012.net.il> for emacs-devel@gnu.org; Fri, 19 Sep 2008 12:13:45 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by monty-python.gnu.org: Solaris 10 (1203?) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:103969 Archived-At: > Date: Thu, 18 Sep 2008 12:02:19 -0400 > From: Paul Michael Reilly > > 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 message.