Show an article with a specified charset.
authorShengHuo ZHU <zsh@cs.rochester.edu>
Wed, 1 Dec 1999 18:16:16 +0000 (18:16 +0000)
committerShengHuo ZHU <zsh@cs.rochester.edu>
Wed, 1 Dec 1999 18:16:16 +0000 (18:16 +0000)
lisp/ChangeLog
lisp/gnus-sum.el
lisp/mm-bodies.el
lisp/rfc2047.el

index e440df2..809fc40 100644 (file)
@@ -1,3 +1,14 @@
+1999-12-01 13:04:09  Shenghuo ZHU  <zsh@cs.rochester.edu>
+
+       * gnus-sum.el (gnus-summary-show-article): Support numbered ARG
+       for charset.
+       (gnus-summary-show-article-charset-alist): New variable.
+       
+       * mm-bodies.el (mm-decode-string): Support gnus-all and
+       gnus-unknown.
+       (mm-decode-body): Ditto.
+       * rfc2047.el (rfc2047-decode): Ditto.
+
 1999-12-01 17:37:18  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
        * mail-source.el (mail-source-delete-incoming): Change default to
@@ -962,7 +973,7 @@ Mon Sep 27 15:18:05 1999  Lars Magne Ingebrigtsen  <larsi@menja.ifi.uio.no>
 
        * gnus-art.el (gnus-treat-predicate): Work for (not 5).
 
-1999-08-27  Peter von der Ah\e-A\ ei\ f  <pahe@daimi.au.dk>
+1999-08-27  Peter von der Ah\ ei\ f  <pahe@daimi.au.dk>
 
        * message.el (message-send): More helpful error message if sending
        fails
@@ -1164,7 +1175,7 @@ Fri Aug 27 13:17:48 1999  Lars Magne Ingebrigtsen  <larsi@menja.ifi.uio.no>
        * gnus-agent.el (gnus-agent-get-undownloaded-list): Don't
        mark cached articles as `undownloaded'.
 
-Tue Jul 20 02:39:56 1999  Peter von der Ah\e-A\ ei\ f  <peter@ahe.dk>
+Tue Jul 20 02:39:56 1999  Peter von der Ah\ ei\ f  <peter@ahe.dk>
 
        * gnus-sum.el (gnus-summary-exit): Allow gnus-use-adaptive-scoring
        to have buffer local values.
@@ -3716,7 +3727,7 @@ Mon Nov 30 23:38:02 1998  Shenghuo ZHU  <zsh@cs.rochester.edu>
 
        * mm-uu.el (mm-uu-dissect): Use mm-make-handle.
 
-1998-12-01 01:53:49  Fran\e-A\ eg\ fois Pinard  <pinard@iro.umontreal.ca>
+1998-12-01 01:53:49  Fran\ eg\ fois Pinard  <pinard@iro.umontreal.ca>
 
        * nndoc.el (nndoc-mime-parts-type-p): Do related.
 
@@ -5462,7 +5473,7 @@ Mon Sep 14 18:55:38 1998  Lars Magne Ingebrigtsen  <larsi@menja.ifi.uio.no>
 
        * rfc2047.el (rfc2047-q-encode-region): Would bug out.
 
-1998-09-13  Fran\e-A\ eg\ fois Pinard  <pinard@iro.umontreal.ca>
+1998-09-13  Fran\ eg\ fois Pinard  <pinard@iro.umontreal.ca>
 
        * nndoc.el: Make nndoc-dissection-alist simpler for MIME, adjust all
           related functions.  Handle message/rfc822 parts.  Display subject on
index dfc7dd9..00ae518 100644 (file)
@@ -849,6 +849,17 @@ This variable uses the same syntax as `gnus-emphasis-alist'."
                                             gnus-emphasis-highlight-words)))))
   :group 'gnus-summary-visual)
 
+(defcustom gnus-summary-show-article-charset-alist
+  nil
+  "Alist of number and charset.
+The article will be shown with the charset corresponding to the
+numbered argument.
+For example: ((1 . cn-gb-2312) (2 . big5))."
+  :type '(repeat (cons (number :tag "Argument" 1)
+                      (symbol :tag "Charset")))
+  :group 'gnus-charset)
+
+
 ;;; Internal variables
 
 (defvar gnus-article-mime-handles nil)
@@ -7110,12 +7121,23 @@ to save in."
 
 (defun gnus-summary-show-article (&optional arg)
   "Force re-fetching of the current article.
-If ARG (the prefix) is non-nil, show the raw article without any
-article massaging functions being run."
+If ARG (the prefix) is a number, show the article with the charset 
+defined in `gnus-summary-show-article-charset-alist', or the charset
+inputed.
+If ARG (the prefix) is non-nil and not a number, show the raw article 
+without any article massaging functions being run."
   (interactive "P")
-  (if (not arg)
-      ;; Select the article the normal way.
-      (gnus-summary-select-article nil 'force)
+  (cond 
+   ((numberp arg)
+    (let ((gnus-newsgroup-charset 
+          (or (cdr (assq arg gnus-summary-show-article-charset-alist))
+              (read-coding-system "Charset: ")))
+         (gnus-newsgroup-ignored-charsets 'gnus-all))
+      (gnus-summary-select-article nil 'force)))
+   ((not arg)
+    ;; Select the article the normal way.
+    (gnus-summary-select-article nil 'force))
+   (t
     ;; We have to require this here to make sure that the following
     ;; dynamic binding isn't shadowed by autoloading.
     (require 'gnus-async)
@@ -7132,7 +7154,7 @@ article massaging functions being run."
        (save-excursion
          (set-buffer gnus-article-buffer)
          (mm-destroy-parts gnus-article-mime-handles)))
-      (gnus-summary-select-article nil 'force)))
+      (gnus-summary-select-article nil 'force))))
   (gnus-summary-goto-subject gnus-current-article)
   (gnus-summary-position-point))
 
index ad7bbeb..8467ef7 100644 (file)
@@ -179,15 +179,22 @@ If no encoding was done, nil is returned."
 The characters in CHARSET should then be decoded."
   (if (stringp charset)
     (setq charset (intern (downcase charset))))
-  (if (or (not charset) (memq charset mail-parse-ignored-charsets))
+  (if (or (not charset) 
+         (eq 'gnus-all mail-parse-ignored-charsets)
+         (memq 'gnus-all mail-parse-ignored-charsets)
+         (memq charset mail-parse-ignored-charsets))
       (setq charset mail-parse-charset))
   (save-excursion
     (when encoding
       (mm-decode-content-transfer-encoding encoding type))
     (when (featurep 'mule)
-      (let (mule-charset)
-       (when (and charset
-                  (setq mule-charset (mm-charset-to-coding-system charset))
+      (let ((mule-charset (mm-charset-to-coding-system charset)))
+       (if (and (not mule-charset)
+                (listp mail-parse-ignored-charsets)
+                (memq 'gnus-unknown mail-parse-ignored-charsets))
+           (setq mule-charset 
+                 (mm-charset-to-coding-system mail-parse-charset)))
+       (when (and charset mule-charset
                   ;; buffer-file-coding-system
                   ;;Article buffer is nil coding system
                   ;;in XEmacs
@@ -201,13 +208,20 @@ The characters in CHARSET should then be decoded."
   "Decode STRING with CHARSET."
   (if (stringp charset)
     (setq charset (intern (downcase charset))))
-  (if (or (not charset) (memq charset mail-parse-ignored-charsets))
+  (if (or (not charset) 
+         (eq 'gnus-all mail-parse-ignored-charsets)
+         (memq 'gnus-all mail-parse-ignored-charsets)
+         (memq charset mail-parse-ignored-charsets))
       (setq charset mail-parse-charset))
   (or
    (when (featurep 'mule)
-     (let (mule-charset)
-       (when (and charset
-                 (setq mule-charset (mm-charset-to-coding-system charset))
+      (let ((mule-charset (mm-charset-to-coding-system charset)))
+       (if (and (not mule-charset)
+                (listp mail-parse-ignored-charsets)
+                (memq 'gnus-unknown mail-parse-ignored-charsets))
+           (setq mule-charset 
+                 (mm-charset-to-coding-system mail-parse-charset)))
+       (when (and charset mule-charset
                  (mm-multibyte-p)
                  (or (not (eq mule-charset 'ascii))
                      (setq mule-charset mail-parse-charset)))
index 1a08b3c..3344753 100644 (file)
@@ -338,9 +338,16 @@ Valid ENCODINGs are \"B\" and \"Q\".
 If your Emacs implementation can't decode CHARSET, it returns nil."
   (if (stringp charset)
     (setq charset (intern (downcase charset))))
-  (if (or (not charset) (memq charset mail-parse-ignored-charsets))
+  (if (or (not charset) 
+         (eq 'gnus-all mail-parse-ignored-charsets)
+         (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)))
+    (if (and (not cs) charset 
+            (listp mail-parse-ignored-charsets)
+            (memq 'gnus-unknown mail-parse-ignored-charsets))
+      (setq cs (mm-charset-to-coding-system mail-parse-charset)))
     (when cs
       (when (and (eq cs 'ascii)
                 mail-parse-charset)