1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-24 10:38:38 +00:00

[Gnus] Allow overriding charset in some decoding functions

This commit is contained in:
Katsumi Yamaoka 2013-11-27 06:39:37 +00:00
parent 52d6635f81
commit 0717822943
5 changed files with 22 additions and 9 deletions

View File

@ -1,5 +1,13 @@
2013-11-27 Katsumi Yamaoka <yamaoka@jpl.org> 2013-11-27 Katsumi Yamaoka <yamaoka@jpl.org>
* gnus-art.el (article-de-quoted-unreadable)
(article-de-base64-unreadable, gnus-mime-copy-part)
* gnus-html.el (gnus-article-html)
* mm-view.el (mm-inline-text-html-render-with-w3)
(mm-inline-text-html-render-with-w3m-standalone)
* rfc2231.el (rfc2231-decode-encoded-string):
Allow overriding charset by mm-charset-override-alist.
* gnus-art.el (gnus-article-browse-html-parts): * gnus-art.el (gnus-article-browse-html-parts):
Replace LWSPs with `&nbsp;'s in header. Replace LWSPs with `&nbsp;'s in header.

View File

@ -2665,7 +2665,7 @@ If READ-CHARSET, ask for a coding system."
(string-match "quoted-printable" type)))) (string-match "quoted-printable" type))))
(article-goto-body) (article-goto-body)
(quoted-printable-decode-region (quoted-printable-decode-region
(point) (point-max) (mm-charset-to-coding-system charset)))))) (point) (point-max) (mm-charset-to-coding-system charset nil t))))))
(defun article-de-base64-unreadable (&optional force read-charset) (defun article-de-base64-unreadable (&optional force read-charset)
"Translate a base64 article. "Translate a base64 article.
@ -2696,7 +2696,8 @@ If READ-CHARSET, ask for a coding system."
(narrow-to-region (point) (point-max)) (narrow-to-region (point) (point-max))
(base64-decode-region (point-min) (point-max)) (base64-decode-region (point-min) (point-max))
(mm-decode-coding-region (mm-decode-coding-region
(point-min) (point-max) (mm-charset-to-coding-system charset))))))) (point-min) (point-max)
(mm-charset-to-coding-system charset nil t)))))))
(eval-when-compile (eval-when-compile
(require 'rfc1843)) (require 'rfc1843))
@ -5247,7 +5248,8 @@ are decompressed."
(switch-to-buffer (generate-new-buffer filename)) (switch-to-buffer (generate-new-buffer filename))
(if (or coding-system (if (or coding-system
(and charset (and charset
(setq coding-system (mm-charset-to-coding-system charset)) (setq coding-system (mm-charset-to-coding-system
charset nil t))
(not (eq coding-system 'ascii)))) (not (eq coding-system 'ascii))))
(progn (progn
(mm-enable-multibyte) (mm-enable-multibyte)

View File

@ -143,7 +143,8 @@ CHARS is a regexp-like character alternative (e.g., \"[)$]\")."
(charset (mail-content-type-get (mm-handle-type handle) (charset (mail-content-type-get (mm-handle-type handle)
'charset))) 'charset)))
(when (and charset (when (and charset
(setq charset (mm-charset-to-coding-system charset)) (setq charset (mm-charset-to-coding-system
charset nil t))
(not (eq charset 'ascii))) (not (eq charset 'ascii)))
(insert (prog1 (insert (prog1
(mm-decode-coding-string (buffer-string) charset) (mm-decode-coding-string (buffer-string) charset)

View File

@ -175,7 +175,7 @@
(match-end 2)))) (match-end 2))))
(if (fboundp 'w3-coding-system-for-mime-charset) (if (fboundp 'w3-coding-system-for-mime-charset)
(w3-coding-system-for-mime-charset bsubstr) (w3-coding-system-for-mime-charset bsubstr)
(mm-charset-to-coding-system bsubstr)))) (mm-charset-to-coding-system bsubstr nil t))))
(delete-region (point-min) (point-max)) (delete-region (point-min) (point-max))
(insert (mm-decode-string text charset)))) (insert (mm-decode-string text charset))))
(save-window-excursion (save-window-excursion
@ -343,9 +343,10 @@
'charset) 'charset)
(symbol-name mail-parse-charset))) (symbol-name mail-parse-charset)))
cs) cs)
(unless (and charset (if (and charset
(setq cs (mm-charset-to-coding-system charset)) (setq cs (mm-charset-to-coding-system charset nil t))
(not (eq cs 'ascii))) (not (eq cs 'ascii)))
(setq charset (format "%s" (mm-coding-system-to-mime-charset cs)))
;; The default. ;; The default.
(setq charset "iso-8859-1" (setq charset "iso-8859-1"
cs 'iso-8859-1)) cs 'iso-8859-1))

View File

@ -215,7 +215,8 @@ These look like:
\"''This%20is%20%2A%2A%2Afun%2A%2A%2A\", or \"''This%20is%20%2A%2A%2Afun%2A%2A%2A\", or
\"This is ***fun***\"." \"This is ***fun***\"."
(string-match "\\`\\(?:\\([^']+\\)?'\\([^']+\\)?'\\)?\\(.+\\)" string) (string-match "\\`\\(?:\\([^']+\\)?'\\([^']+\\)?'\\)?\\(.+\\)" string)
(let ((coding-system (mm-charset-to-coding-system (match-string 1 string))) (let ((coding-system (mm-charset-to-coding-system
(match-string 1 string) nil t))
;;(language (match-string 2 string)) ;;(language (match-string 2 string))
(value (match-string 3 string))) (value (match-string 3 string)))
(mm-with-unibyte-buffer (mm-with-unibyte-buffer