aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKatsumi Yamaoka2013-11-27 06:39:37 +0000
committerKatsumi Yamaoka2013-11-27 06:39:37 +0000
commit0717822943efa5013dffa1494f528e23d102ae72 (patch)
tree286a1a348b9bef33ed04e561d2dd7ea1c6b8088d
parent52d6635f8170ad0f5269afb47dc41d5527fbe65c (diff)
downloademacs-0717822943efa5013dffa1494f528e23d102ae72.tar.gz
emacs-0717822943efa5013dffa1494f528e23d102ae72.zip
[Gnus] Allow overriding charset in some decoding functions
-rw-r--r--lisp/gnus/ChangeLog8
-rw-r--r--lisp/gnus/gnus-art.el8
-rw-r--r--lisp/gnus/gnus-html.el3
-rw-r--r--lisp/gnus/mm-view.el9
-rw-r--r--lisp/gnus/rfc2231.el3
5 files changed, 22 insertions, 9 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index eee75f7194f..bea916187bf 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,5 +1,13 @@
12013-11-27 Katsumi Yamaoka <yamaoka@jpl.org> 12013-11-27 Katsumi Yamaoka <yamaoka@jpl.org>
2 2
3 * gnus-art.el (article-de-quoted-unreadable)
4 (article-de-base64-unreadable, gnus-mime-copy-part)
5 * gnus-html.el (gnus-article-html)
6 * mm-view.el (mm-inline-text-html-render-with-w3)
7 (mm-inline-text-html-render-with-w3m-standalone)
8 * rfc2231.el (rfc2231-decode-encoded-string):
9 Allow overriding charset by mm-charset-override-alist.
10
3 * gnus-art.el (gnus-article-browse-html-parts): 11 * gnus-art.el (gnus-article-browse-html-parts):
4 Replace LWSPs with `&nbsp;'s in header. 12 Replace LWSPs with `&nbsp;'s in header.
5 13
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index a902cb9024a..9eac2c428e9 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -2665,7 +2665,7 @@ If READ-CHARSET, ask for a coding system."
2665 (string-match "quoted-printable" type)))) 2665 (string-match "quoted-printable" type))))
2666 (article-goto-body) 2666 (article-goto-body)
2667 (quoted-printable-decode-region 2667 (quoted-printable-decode-region
2668 (point) (point-max) (mm-charset-to-coding-system charset)))))) 2668 (point) (point-max) (mm-charset-to-coding-system charset nil t))))))
2669 2669
2670(defun article-de-base64-unreadable (&optional force read-charset) 2670(defun article-de-base64-unreadable (&optional force read-charset)
2671 "Translate a base64 article. 2671 "Translate a base64 article.
@@ -2696,7 +2696,8 @@ If READ-CHARSET, ask for a coding system."
2696 (narrow-to-region (point) (point-max)) 2696 (narrow-to-region (point) (point-max))
2697 (base64-decode-region (point-min) (point-max)) 2697 (base64-decode-region (point-min) (point-max))
2698 (mm-decode-coding-region 2698 (mm-decode-coding-region
2699 (point-min) (point-max) (mm-charset-to-coding-system charset))))))) 2699 (point-min) (point-max)
2700 (mm-charset-to-coding-system charset nil t)))))))
2700 2701
2701(eval-when-compile 2702(eval-when-compile
2702 (require 'rfc1843)) 2703 (require 'rfc1843))
@@ -5247,7 +5248,8 @@ are decompressed."
5247 (switch-to-buffer (generate-new-buffer filename)) 5248 (switch-to-buffer (generate-new-buffer filename))
5248 (if (or coding-system 5249 (if (or coding-system
5249 (and charset 5250 (and charset
5250 (setq coding-system (mm-charset-to-coding-system charset)) 5251 (setq coding-system (mm-charset-to-coding-system
5252 charset nil t))
5251 (not (eq coding-system 'ascii)))) 5253 (not (eq coding-system 'ascii))))
5252 (progn 5254 (progn
5253 (mm-enable-multibyte) 5255 (mm-enable-multibyte)
diff --git a/lisp/gnus/gnus-html.el b/lisp/gnus/gnus-html.el
index 2700af3d009..36c1677be0a 100644
--- a/lisp/gnus/gnus-html.el
+++ b/lisp/gnus/gnus-html.el
@@ -143,7 +143,8 @@ CHARS is a regexp-like character alternative (e.g., \"[)$]\")."
143 (charset (mail-content-type-get (mm-handle-type handle) 143 (charset (mail-content-type-get (mm-handle-type handle)
144 'charset))) 144 'charset)))
145 (when (and charset 145 (when (and charset
146 (setq charset (mm-charset-to-coding-system charset)) 146 (setq charset (mm-charset-to-coding-system
147 charset nil t))
147 (not (eq charset 'ascii))) 148 (not (eq charset 'ascii)))
148 (insert (prog1 149 (insert (prog1
149 (mm-decode-coding-string (buffer-string) charset) 150 (mm-decode-coding-string (buffer-string) charset)
diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el
index 9512a411d81..48124f17ef9 100644
--- a/lisp/gnus/mm-view.el
+++ b/lisp/gnus/mm-view.el
@@ -175,7 +175,7 @@
175 (match-end 2)))) 175 (match-end 2))))
176 (if (fboundp 'w3-coding-system-for-mime-charset) 176 (if (fboundp 'w3-coding-system-for-mime-charset)
177 (w3-coding-system-for-mime-charset bsubstr) 177 (w3-coding-system-for-mime-charset bsubstr)
178 (mm-charset-to-coding-system bsubstr)))) 178 (mm-charset-to-coding-system bsubstr nil t))))
179 (delete-region (point-min) (point-max)) 179 (delete-region (point-min) (point-max))
180 (insert (mm-decode-string text charset)))) 180 (insert (mm-decode-string text charset))))
181 (save-window-excursion 181 (save-window-excursion
@@ -343,9 +343,10 @@
343 'charset) 343 'charset)
344 (symbol-name mail-parse-charset))) 344 (symbol-name mail-parse-charset)))
345 cs) 345 cs)
346 (unless (and charset 346 (if (and charset
347 (setq cs (mm-charset-to-coding-system charset)) 347 (setq cs (mm-charset-to-coding-system charset nil t))
348 (not (eq cs 'ascii))) 348 (not (eq cs 'ascii)))
349 (setq charset (format "%s" (mm-coding-system-to-mime-charset cs)))
349 ;; The default. 350 ;; The default.
350 (setq charset "iso-8859-1" 351 (setq charset "iso-8859-1"
351 cs 'iso-8859-1)) 352 cs 'iso-8859-1))
diff --git a/lisp/gnus/rfc2231.el b/lisp/gnus/rfc2231.el
index e8d7075bc65..4baacde8ea4 100644
--- a/lisp/gnus/rfc2231.el
+++ b/lisp/gnus/rfc2231.el
@@ -215,7 +215,8 @@ These look like:
215 \"''This%20is%20%2A%2A%2Afun%2A%2A%2A\", or 215 \"''This%20is%20%2A%2A%2Afun%2A%2A%2A\", or
216 \"This is ***fun***\"." 216 \"This is ***fun***\"."
217 (string-match "\\`\\(?:\\([^']+\\)?'\\([^']+\\)?'\\)?\\(.+\\)" string) 217 (string-match "\\`\\(?:\\([^']+\\)?'\\([^']+\\)?'\\)?\\(.+\\)" string)
218 (let ((coding-system (mm-charset-to-coding-system (match-string 1 string))) 218 (let ((coding-system (mm-charset-to-coding-system
219 (match-string 1 string) nil t))
219 ;;(language (match-string 2 string)) 220 ;;(language (match-string 2 string))
220 (value (match-string 3 string))) 221 (value (match-string 3 string)))
221 (mm-with-unibyte-buffer 222 (mm-with-unibyte-buffer