diff options
Diffstat (limited to 'lisp/gnus/mm-util.el')
-rw-r--r-- | lisp/gnus/mm-util.el | 79 |
1 files changed, 7 insertions, 72 deletions
diff --git a/lisp/gnus/mm-util.el b/lisp/gnus/mm-util.el index 76b1f2779c9..eb67313c92a 100644 --- a/lisp/gnus/mm-util.el +++ b/lisp/gnus/mm-util.el @@ -474,6 +474,10 @@ could use `autoload-coding-system' here." (iso-2022-jp latin-jisx0201 japanese-jisx0208 japanese-jisx0208-1978) (euc-kr korean-ksc5601) (gb2312 chinese-gb2312) + (gbk chinese-gbk) + (gb18030 gb18030-2-byte + gb18030-4-byte-bmp gb18030-4-byte-smp + gb18030-4-byte-ext-1 gb18030-4-byte-ext-2) (big5 chinese-big5-1 chinese-big5-2) (tibetan tibetan) (thai-tis620 thai-tis620) @@ -542,7 +546,7 @@ with Mule charsets. It is completely useless for Emacs." cs mime mule alist) (while css (setq cs (pop css) - mime (or (coding-system-get cs :mime-charset) ; Emacs 23 (unicode) + mime (or (coding-system-get cs :mime-charset); Emacs 23 (unicode) (coding-system-get cs 'mime-charset))) (when (and mime (not (eq t (setq mule @@ -551,36 +555,6 @@ with Mule charsets. It is completely useless for Emacs." (push (cons mime (delq 'ascii mule)) alist))) (setq mm-mime-mule-charset-alist (nreverse alist))))) -(defvar mm-hack-charsets '(iso-8859-15 iso-2022-jp-2) - "A list of special charsets. -Valid elements include: -`iso-8859-15' convert ISO-8859-1, -9 to ISO-8859-15 if ISO-8859-15 exists. -`iso-2022-jp-2' convert ISO-2022-jp to ISO-2022-jp-2 if ISO-2022-jp-2 exists." -) - -(defvar mm-iso-8859-15-compatible - '((iso-8859-1 "\xA4\xA6\xA8\xB4\xB8\xBC\xBD\xBE") - (iso-8859-9 "\xA4\xA6\xA8\xB4\xB8\xBC\xBD\xBE\xD0\xDD\xDE\xF0\xFD\xFE")) - "ISO-8859-15 exchangeable coding systems and inconvertible characters.") - -(defvar mm-iso-8859-x-to-15-table - (and (fboundp 'coding-system-p) - (mm-coding-system-p 'iso-8859-15) - (mapcar - (lambda (cs) - (if (mm-coding-system-p (car cs)) - (let ((c (string-to-char - (decode-coding-string "\341" (car cs))))) - (cons (char-charset c) - (cons - (- (string-to-char - (decode-coding-string "\341" 'iso-8859-15)) c) - (string-to-list (decode-coding-string (car (cdr cs)) - (car cs)))))) - '(gnus-charset 0))) - mm-iso-8859-15-compatible)) - "A table of the difference character between ISO-8859-X and ISO-8859-15.") - (defcustom mm-coding-system-priorities (if (boundp 'current-language-environment) (let ((lang (symbol-value 'current-language-environment))) @@ -837,27 +811,6 @@ This affects whether coding conversion should be attempted generally." default-enable-multibyte-characters t))) -(defun mm-iso-8859-x-to-15-region (&optional b e) - (if (fboundp 'char-charset) - (let (charset item c inconvertible) - (save-restriction - (if e (narrow-to-region b e)) - (goto-char (point-min)) - (skip-chars-forward "\0-\177") - (while (not (eobp)) - (cond - ((not (setq item (assq (char-charset (setq c (char-after))) - mm-iso-8859-x-to-15-table))) - (forward-char)) - ((memq c (cdr (cdr item))) - (setq inconvertible t) - (forward-char)) - (t - (insert-before-markers (prog1 (+ c (car (cdr item))) - (delete-char 1))))) - (skip-chars-forward "\0-\177"))) - (not inconvertible)))) - (defun mm-sort-coding-systems-predicate (a b) (let ((priorities (mapcar (lambda (cs) @@ -994,32 +947,14 @@ charset, and a longer list means no appropriate charset." ;; Otherwise, we'll get nil, and the next setq will get invoked. (setq charsets (mm-xemacs-find-mime-charset b e)) + ;; Fixme: won't work for unibyte Emacs 23: + ;; We're not multibyte, or a single coding system won't cover it. (setq charsets (mm-delete-duplicates (mapcar 'mm-mime-charset (delq 'ascii (mm-find-charset-region b e)))))) - (if (and (> (length charsets) 1) - (memq 'iso-8859-15 charsets) - (memq 'iso-8859-15 hack-charsets) - (save-excursion (mm-iso-8859-x-to-15-region b e))) - (mapcar (lambda (x) (setq charsets (delq (car x) charsets))) - mm-iso-8859-15-compatible)) - (if (and (memq 'iso-2022-jp-2 charsets) - (memq 'iso-2022-jp-2 hack-charsets)) - (setq charsets (delq 'iso-2022-jp charsets))) - ;; Attempt to reduce the number of charsets if utf-8 is available. - (if (and (featurep 'xemacs) - (> (length charsets) 1) - (mm-coding-system-p 'utf-8)) - (let ((mm-coding-system-priorities - (cons 'utf-8 mm-coding-system-priorities))) - (setq charsets - (mm-delete-duplicates - (mapcar 'mm-mime-charset - (delq 'ascii - (mm-find-charset-region b e))))))) charsets)) (defmacro mm-with-unibyte-buffer (&rest forms) |