diff lisp/gnus/rfc2047.el @ 100315:da90832da238

* rfc2047.el (rfc2047-charset-to-coding-system): Add new argument `allow-override' which says whether to use `mm-charset-override-alist'. (rfc2047-decode-encoded-words): Use it. * mm-util.el (mm-charset-override-alist): Fix custom type; add `(gb2312 . gbk)' to choices.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Wed, 10 Dec 2008 10:02:50 +0000
parents c3309dba6542
children a9dc0e7c3f2b
line wrap: on
line diff
--- a/lisp/gnus/rfc2047.el	Wed Dec 10 09:47:06 2008 +0000
+++ b/lisp/gnus/rfc2047.el	Wed Dec 10 10:02:50 2008 +0000
@@ -902,9 +902,13 @@
 	    (error
 	     (goto-char beg))))))))
 
-(defun rfc2047-charset-to-coding-system (charset)
+(defun rfc2047-charset-to-coding-system (charset &optional allow-override)
   "Return coding-system corresponding to MIME CHARSET.
-If your Emacs implementation can't decode CHARSET, return nil."
+If your Emacs implementation can't decode CHARSET, return nil.
+
+If allow-override is given, use `mm-charset-override-alist' to
+map undesired charset names to their replacement.  This should
+only be used for decoding, not for encoding."
   (when (stringp charset)
     (setq charset (intern (downcase charset))))
   (when (or (not charset)
@@ -912,7 +916,7 @@
 	    (memq 'gnus-all mail-parse-ignored-charsets)
 	    (memq charset mail-parse-ignored-charsets))
     (setq charset mail-parse-charset))
-  (let ((cs (mm-charset-to-coding-system charset)))
+  (let ((cs (mm-charset-to-coding-system charset nil allow-override)))
     (cond ((eq cs 'ascii)
 	   (setq cs (or (mm-charset-to-coding-system mail-parse-charset)
 			'raw-text)))
@@ -933,7 +937,7 @@
     (while words
       (setq word (pop words))
       (if (and (setq cs (rfc2047-charset-to-coding-system
-			 (setq charset (car word))))
+			 (setq charset (car word)) t))
 	       (condition-case code
 		   (cond ((char-equal ?B (nth 1 word))
 			  (setq text (base64-decode-string