Guess charset from original article buffer.
authorShengHuo ZHU <zsh@cs.rochester.edu>
Fri, 15 Sep 2000 02:25:43 +0000 (02:25 +0000)
committerShengHuo ZHU <zsh@cs.rochester.edu>
Fri, 15 Sep 2000 02:25:43 +0000 (02:25 +0000)
lisp/ChangeLog
lisp/gnus-art.el

index 7d59183..0c157ac 100644 (file)
@@ -1,3 +1,10 @@
+2000-09-14 23:13:50  ShengHuo ZHU  <zsh@cs.rochester.edu>
+
+       * gnus-art.el (article-de-quoted-unreadable): Guess charset from
+       original article buffer.
+       (article-de-base64-unreadable): Ditto.
+       (article-wash-html): Ditto.
+
 2000-09-14 18:55:30  ShengHuo ZHU  <zsh@cs.rochester.edu>
 
        * gnus-msg.el (gnus-summary-mail-forward): Disable multibyte
index c552c96..31307fb 100644 (file)
@@ -1510,9 +1510,21 @@ If FORCE, decode the article whether it is marked as quoted-printable
 or not."
   (interactive (list 'force))
   (save-excursion
-    (let ((buffer-read-only nil)
-         (type (gnus-fetch-field "content-transfer-encoding"))
-         (charset gnus-newsgroup-charset))
+    (let ((buffer-read-only nil) type charset)
+      (if (gnus-buffer-live-p gnus-original-article-buffer)
+         (with-current-buffer gnus-original-article-buffer
+           (setq type
+                 (gnus-fetch-field "content-transfer-encoding"))
+           (let* ((ct (gnus-fetch-field "content-type"))
+                  (ctl (and ct 
+                            (ignore-errors
+                              (mail-header-parse-content-type ct)))))
+             (setq charset (and ctl
+                                (mail-content-type-get ctl 'charset)))
+             (if (stringp charset)
+                 (setq charset (intern (downcase charset)))))))
+      (unless charset 
+       (setq charset gnus-newsgroup-charset))
       (when (or force
                (and type (string-match "quoted-printable" (downcase type))))
        (article-goto-body)
@@ -1523,9 +1535,21 @@ or not."
 If FORCE, decode the article whether it is marked as base64 not."
   (interactive (list 'force))
   (save-excursion
-    (let ((buffer-read-only nil)
-         (type (gnus-fetch-field "content-transfer-encoding"))
-         (charset gnus-newsgroup-charset))
+    (let ((buffer-read-only nil) type charset)
+      (if (gnus-buffer-live-p gnus-original-article-buffer)
+         (with-current-buffer gnus-original-article-buffer
+           (setq type
+                 (gnus-fetch-field "content-transfer-encoding"))
+           (let* ((ct (gnus-fetch-field "content-type"))
+                  (ctl (and ct 
+                            (ignore-errors
+                              (mail-header-parse-content-type ct)))))
+             (setq charset (and ctl
+                                (mail-content-type-get ctl 'charset)))
+             (if (stringp charset)
+                 (setq charset (intern (downcase charset)))))))
+      (unless charset 
+       (setq charset gnus-newsgroup-charset))
       (when (or force
                (and type (string-match "base64" (downcase type))))
        (article-goto-body)
@@ -1551,7 +1575,19 @@ If FORCE, decode the article whether it is marked as base64 not."
   (interactive)
   (save-excursion
     (let ((buffer-read-only nil)
-         (charset gnus-newsgroup-charset))
+         charset)
+      (if (gnus-buffer-live-p gnus-original-article-buffer)
+         (with-current-buffer gnus-original-article-buffer
+           (let* ((ct (gnus-fetch-field "content-type"))
+                  (ctl (and ct 
+                            (ignore-errors
+                              (mail-header-parse-content-type ct)))))
+             (setq charset (and ctl
+                                (mail-content-type-get ctl 'charset)))
+             (if (stringp charset)
+                 (setq charset (intern (downcase charset)))))))
+      (unless charset 
+       (setq charset gnus-newsgroup-charset))
       (article-goto-body)
       (save-window-excursion
        (save-restriction