From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Alexander Pohoyda Newsgroups: gmane.emacs.bugs Subject: RMAIL, multipart MIME-type, charset fix Date: Sun, 28 Sep 2003 23:56:29 +0200 (CEST) Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <200309282156.h8SLuTpV006739@oak.pohoyda.family> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="2003-09-28T23:54:48+0200_=_d45e3272" Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1064786565 15193 80.91.224.253 (28 Sep 2003 22:02:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 28 Sep 2003 22:02:45 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Sep 29 00:02:43 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1A3jcp-0001pq-00 for ; Mon, 29 Sep 2003 00:02:43 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.22) id 1A3jc0-0000K5-2F for geb-bug-gnu-emacs@m.gmane.org; Sun, 28 Sep 2003 18:01:52 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.22) id 1A3jbw-0000IF-O5 for bug-gnu-emacs@gnu.org; Sun, 28 Sep 2003 18:01:48 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.22) id 1A3jbu-0000El-4U for bug-gnu-emacs@gnu.org; Sun, 28 Sep 2003 18:01:47 -0400 Original-Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.22) id 1A3jWr-0007JD-Rc for bug-gnu-emacs@gnu.org; Sun, 28 Sep 2003 17:56:34 -0400 Original-Received: (qmail 16777 invoked by uid 65534); 28 Sep 2003 21:56:29 -0000 Original-Received: from p508BF490.dip.t-dialin.net (EHLO oak.pohoyda.family) (80.139.244.144) by mail.gmx.net (mp027) with SMTP; 28 Sep 2003 23:56:29 +0200 X-Authenticated: #14602519 Original-Received: from oak.pohoyda.family (oak.pohoyda.family [127.0.0.1]) by oak.pohoyda.family (8.12.9/8.12.9) with ESMTP id h8SLuTVi006742 for ; Sun, 28 Sep 2003 23:56:29 +0200 (CEST) (envelope-from apog@oak.pohoyda.family) Original-Received: (from apog@localhost) by oak.pohoyda.family (8.12.9/8.12.9/Submit) id h8SLuTpV006739; Sun, 28 Sep 2003 23:56:29 +0200 (CEST) (envelope-from apog) Original-To: bug-gnu-emacs@gnu.org X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:5873 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:5873 > This is a multipart message in MIME format. --2003-09-28T23:54:48+0200_=_d45e3272 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Hi all, Current behaviour: RMAIL searches the message header for the Content-Type header field with text/plain type, and tries to find out the MIME-charset used (charset attribute). That's nice, but if the message comes in multipart type, no such header field is found, thus the undecided coding system is used instead. In other words, RMAIL does not handle the multipart MIME-type. While I'm working on the correct solution (implementing missing RFC 2045, 2046, 2047 functionality), attached patch solves the problem today. It tries to find the wanted header field in the whole message, if it was not found in the message header. This should work for 98% of cases, I suppose. Thanks for taking a look. Diff against the current CVS. -- Alexander Pohoyda PGP Key fingerprint: 7F C9 CC 5A 75 CD 89 72 15 54 5F 62 20 23 C6 44 --2003-09-28T23:54:48+0200_=_d45e3272 Content-Type: text/x-patch; charset="us-ascii" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="rmail.el.diff" Content-Description: rmail.el.diff --- /workspace/emacs/lisp/mail/rmail.el Wed Sep 3 22:11:40 2003 +++ /usr/local/share/emacs/21.3.50/lisp/mail/rmail.el Sun Sep 28 23:27:45 2003 @@ -1703,13 +1703,20 @@ (not rmail-enable-multibyte) (let ((mime-charset (if (and rmail-decode-mime-charset - (save-excursion - (goto-char start) - (search-forward "\n\n" nil t) - (let ((case-fold-search t)) - (re-search-backward - rmail-mime-charset-pattern - start t)))) + (or + (save-excursion + (goto-char start) + (search-forward "\n\n" nil t) + (let ((case-fold-search t)) + (re-search-backward + rmail-mime-charset-pattern + start t))) + ;; Try to search the whole message + (save-excursion + (let ((case-fold-search t)) + (re-search-backward + rmail-mime-charset-pattern + start t))))) (intern (downcase (match-string 1)))))) (rmail-decode-region start (point) mime-charset))))) ;; Add an X-Coding-System: header if we don't have one. @@ -1843,13 +1850,20 @@ (not rmail-enable-multibyte) (let ((mime-charset (if (and rmail-decode-mime-charset - (save-excursion - (goto-char start) - (search-forward "\n\n" nil t) - (let ((case-fold-search t)) - (re-search-backward - rmail-mime-charset-pattern - start t)))) + (or + (save-excursion + (goto-char start) + (search-forward "\n\n" nil t) + (let ((case-fold-search t)) + (re-search-backward + rmail-mime-charset-pattern + start t))) + ;; Try to search the whole message + (save-excursion + (let ((case-fold-search t)) + (re-search-backward + rmail-mime-charset-pattern + start t))))) (intern (downcase (match-string 1)))))) (rmail-decode-region start (point) mime-charset))) (save-excursion --2003-09-28T23:54:48+0200_=_d45e3272 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Bug-gnu-emacs mailing list Bug-gnu-emacs@gnu.org http://mail.gnu.org/mailman/listinfo/bug-gnu-emacs --2003-09-28T23:54:48+0200_=_d45e3272--