diff options
| author | Katsumi Yamaoka | 2008-12-10 10:02:50 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2008-12-10 10:02:50 +0000 |
| commit | b6b8f5fda993e752657e4a09bfa6022e42df673c (patch) | |
| tree | b6be40c38ba5efcdf286c1862bbef8c6a26a26b8 | |
| parent | c3f995a2cbc9715b56d732b28b078c102dccccd3 (diff) | |
| download | emacs-b6b8f5fda993e752657e4a09bfa6022e42df673c.tar.gz emacs-b6b8f5fda993e752657e4a09bfa6022e42df673c.zip | |
* 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.
| -rw-r--r-- | lisp/gnus/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/gnus/mm-util.el | 45 | ||||
| -rw-r--r-- | lisp/gnus/rfc2047.el | 12 |
3 files changed, 53 insertions, 13 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 59535f7faa5..3e445c847c1 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2008-12-10 Katsumi Yamaoka <yamaoka@jpl.org> | ||
| 2 | |||
| 3 | * rfc2047.el (rfc2047-charset-to-coding-system): Add new argument | ||
| 4 | `allow-override' which says whether to use `mm-charset-override-alist'. | ||
| 5 | (rfc2047-decode-encoded-words): Use it. | ||
| 6 | |||
| 7 | * mm-util.el (mm-charset-override-alist): Fix custom type; | ||
| 8 | add `(gb2312 . gbk)' to choices. | ||
| 9 | |||
| 1 | 2008-12-04 Katsumi Yamaoka <yamaoka@jpl.org> | 10 | 2008-12-04 Katsumi Yamaoka <yamaoka@jpl.org> |
| 2 | 11 | ||
| 3 | * mm-view.el (mm-inline-text-html-render-with-w3m): Make it simple and | 12 | * mm-view.el (mm-inline-text-html-render-with-w3m): Make it simple and |
diff --git a/lisp/gnus/mm-util.el b/lisp/gnus/mm-util.el index 383b1b87916..4630cefc25e 100644 --- a/lisp/gnus/mm-util.el +++ b/lisp/gnus/mm-util.el | |||
| @@ -397,15 +397,42 @@ Unless LIST is given, `mm-codepage-ibm-list' is used." | |||
| 397 | You may add pairs like (iso-8859-1 . windows-1252) here, | 397 | You may add pairs like (iso-8859-1 . windows-1252) here, |
| 398 | i.e. treat iso-8859-1 as windows-1252. windows-1252 is a | 398 | i.e. treat iso-8859-1 as windows-1252. windows-1252 is a |
| 399 | superset of iso-8859-1." | 399 | superset of iso-8859-1." |
| 400 | :type '(list (set :inline t | 400 | :type |
| 401 | (const (iso-8859-1 . windows-1252)) | 401 | '(list |
| 402 | (const (iso-8859-8 . windows-1255)) | 402 | :convert-widget |
| 403 | (const (iso-8859-9 . windows-1254)) | 403 | (lambda (widget) |
| 404 | (const (undecided . windows-1252))) | 404 | (let ((defaults |
| 405 | (repeat :inline t | 405 | (delq nil |
| 406 | :tag "Other options" | 406 | (mapcar (lambda (pair) |
| 407 | (cons (symbol :tag "From charset") | 407 | (if (mm-charset-to-coding-system (cdr pair)) |
| 408 | (symbol :tag "To charset")))) | 408 | pair)) |
| 409 | '((gb2312 . gbk) | ||
| 410 | (iso-8859-1 . windows-1252) | ||
| 411 | (iso-8859-8 . windows-1255) | ||
| 412 | (iso-8859-9 . windows-1254) | ||
| 413 | (undecided . windows-1252))))) | ||
| 414 | (val (copy-sequence (default-value 'mm-charset-override-alist))) | ||
| 415 | pair rest) | ||
| 416 | (while val | ||
| 417 | (push (if (and (prog1 | ||
| 418 | (setq pair (assq (caar val) defaults)) | ||
| 419 | (setq defaults (delq pair defaults))) | ||
| 420 | (equal (car val) pair)) | ||
| 421 | `(const ,pair) | ||
| 422 | `(cons :format "%v" | ||
| 423 | (const :format "(%v" ,(caar val)) | ||
| 424 | (symbol :size 3 :format " . %v)\n" ,(cdar val)))) | ||
| 425 | rest) | ||
| 426 | (setq val (cdr val))) | ||
| 427 | (while defaults | ||
| 428 | (push `(const ,(pop defaults)) rest)) | ||
| 429 | (widget-convert | ||
| 430 | 'list | ||
| 431 | `(set :inline t :format "%v" ,@(nreverse rest)) | ||
| 432 | `(repeat :inline t :tag "Other options" | ||
| 433 | (cons :format "%v" | ||
| 434 | (symbol :size 3 :format "(%v") | ||
| 435 | (symbol :size 3 :format " . %v)\n"))))))) | ||
| 409 | :version "22.1" ;; Gnus 5.10.9 | 436 | :version "22.1" ;; Gnus 5.10.9 |
| 410 | :group 'mime) | 437 | :group 'mime) |
| 411 | 438 | ||
diff --git a/lisp/gnus/rfc2047.el b/lisp/gnus/rfc2047.el index ea5274798be..fb1c3606ed5 100644 --- a/lisp/gnus/rfc2047.el +++ b/lisp/gnus/rfc2047.el | |||
| @@ -902,9 +902,13 @@ them.") | |||
| 902 | (error | 902 | (error |
| 903 | (goto-char beg)))))))) | 903 | (goto-char beg)))))))) |
| 904 | 904 | ||
| 905 | (defun rfc2047-charset-to-coding-system (charset) | 905 | (defun rfc2047-charset-to-coding-system (charset &optional allow-override) |
| 906 | "Return coding-system corresponding to MIME CHARSET. | 906 | "Return coding-system corresponding to MIME CHARSET. |
| 907 | If your Emacs implementation can't decode CHARSET, return nil." | 907 | If your Emacs implementation can't decode CHARSET, return nil. |
| 908 | |||
| 909 | If allow-override is given, use `mm-charset-override-alist' to | ||
| 910 | map undesired charset names to their replacement. This should | ||
| 911 | only be used for decoding, not for encoding." | ||
| 908 | (when (stringp charset) | 912 | (when (stringp charset) |
| 909 | (setq charset (intern (downcase charset)))) | 913 | (setq charset (intern (downcase charset)))) |
| 910 | (when (or (not charset) | 914 | (when (or (not charset) |
| @@ -912,7 +916,7 @@ If your Emacs implementation can't decode CHARSET, return nil." | |||
| 912 | (memq 'gnus-all mail-parse-ignored-charsets) | 916 | (memq 'gnus-all mail-parse-ignored-charsets) |
| 913 | (memq charset mail-parse-ignored-charsets)) | 917 | (memq charset mail-parse-ignored-charsets)) |
| 914 | (setq charset mail-parse-charset)) | 918 | (setq charset mail-parse-charset)) |
| 915 | (let ((cs (mm-charset-to-coding-system charset))) | 919 | (let ((cs (mm-charset-to-coding-system charset nil allow-override))) |
| 916 | (cond ((eq cs 'ascii) | 920 | (cond ((eq cs 'ascii) |
| 917 | (setq cs (or (mm-charset-to-coding-system mail-parse-charset) | 921 | (setq cs (or (mm-charset-to-coding-system mail-parse-charset) |
| 918 | 'raw-text))) | 922 | 'raw-text))) |
| @@ -933,7 +937,7 @@ ENCODED-WORD)." | |||
| 933 | (while words | 937 | (while words |
| 934 | (setq word (pop words)) | 938 | (setq word (pop words)) |
| 935 | (if (and (setq cs (rfc2047-charset-to-coding-system | 939 | (if (and (setq cs (rfc2047-charset-to-coding-system |
| 936 | (setq charset (car word)))) | 940 | (setq charset (car word)) t)) |
| 937 | (condition-case code | 941 | (condition-case code |
| 938 | (cond ((char-equal ?B (nth 1 word)) | 942 | (cond ((char-equal ?B (nth 1 word)) |
| 939 | (setq text (base64-decode-string | 943 | (setq text (base64-decode-string |