unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alexander Pohoyda <alexander.pohoyda@gmx.net>
Subject: RMAIL, multipart MIME-type, charset fix
Date: Sun, 28 Sep 2003 23:56:29 +0200 (CEST)	[thread overview]
Message-ID: <200309282156.h8SLuTpV006739@oak.pohoyda.family> (raw)

[-- Attachment #1: Type: text/plain, Size: 859 bytes --]

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 <alexander.pohoyda@gmx.net>
PGP Key fingerprint: 7F C9 CC 5A 75 CD 89 72  15 54 5F 62 20 23 C6 44


[-- Attachment #2: rmail.el.diff --]
[-- Type: text/x-patch, Size: 1970 bytes --]


--- /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

[-- Attachment #3: Type: text/plain, Size: 148 bytes --]

_______________________________________________
Bug-gnu-emacs mailing list
Bug-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-gnu-emacs

             reply	other threads:[~2003-09-28 21:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-28 21:56 Alexander Pohoyda [this message]
2003-09-29  6:10 ` RMAIL, multipart MIME-type, charset fix Eli Zaretskii
2003-09-29 10:10   ` Alexander Pohoyda
2003-09-29 16:26     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200309282156.h8SLuTpV006739@oak.pohoyda.family \
    --to=alexander.pohoyda@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).