[gnus git] branch master updated: m0-7-201-g3065191 =1= rfc2047.el (rfc2047-encode-message-header): Unify charsets into a single one used for encoding the whole text in a header

Katsumi Yamaoka <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  30651911fee6c0e8fd633b82cde7ce2524839dff (commit)
      from  eb79966aceba905515b2be7f3e35da678cde42b7 (commit)


- Log -----------------------------------------------------------------
commit 30651911fee6c0e8fd633b82cde7ce2524839dff
Author: Katsumi Yamaoka <[email protected]>
Date:   Fri Aug 2 08:36:03 2013 +0000

    rfc2047.el (rfc2047-encode-message-header): Unify charsets into a single one used for encoding the whole text in a header

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ce139f0..cdf48d1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2013-08-02  Katsumi Yamaoka  <[email protected]>
+
+	* rfc2047.el (rfc2047-encode-message-header): Unify charsets into
+	a single one used for encoding the whole text in a header.
+
 2013-08-02  Lars Magne Ingebrigtsen  <[email protected]>
 
 	* dgnushack.el (dgnushack-compile): `icalendar--decode-isodatetime'
diff --git a/lisp/rfc2047.el b/lisp/rfc2047.el
index a9498d4..ebf5974 100644
--- a/lisp/rfc2047.el
+++ b/lisp/rfc2047.el
@@ -235,12 +235,23 @@ Should be called narrowed to the head of the message."
   (interactive "*")
   (save-excursion
     (goto-char (point-min))
-    (let (alist elem method)
+    (let (alist elem method charsets)
       (while (not (eobp))
 	(save-restriction
 	  (rfc2047-narrow-to-field)
 	  (setq method nil
-		alist rfc2047-header-encoding-alist)
+		alist rfc2047-header-encoding-alist
+		charsets (mm-find-mime-charset-region (point-min) (point-max)))
+	  ;; M$ Outlook boycotts decoding of a header if it consists
+	  ;; of two or more encoded words and those charsets differ;
+	  ;; it seems to decode all words in a header from a charset
+	  ;; found first in the header.  So, we unify the charsets into
+	  ;; a single one used for encoding the whole text in a header.
+	  (let ((mm-coding-system-priorities
+		 (if (= (length charsets) 1)
+		     (cons (mm-charset-to-coding-system (car charsets))
+			   mm-coding-system-priorities)
+		   mm-coding-system-priorities)))
 	  (while (setq elem (pop alist))
 	    (when (or (and (stringp (car elem))
 			   (looking-at (car elem)))
@@ -313,7 +324,7 @@ Should be called narrowed to the head of the message."
 		  (mm-encode-coding-region (point) (point-max) method)))
 	     ;; Hm.
 	     (t)))
-	  (goto-char (point-max)))))))
+	    (goto-char (point-max))))))))
 
 ;; Fixme: This, and the require below may not be the Right Thing, but
 ;; should be safe just before release.  -- fx 2001-02-08

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog  |    5 ++
 lisp/rfc2047.el |  161 +++++++++++++++++++++++++++++-------------------------
 2 files changed, 91 insertions(+), 75 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.