247 |
(coding-system-get cs 'safe-charsets)))))) |
(coding-system-get cs 'safe-charsets)))))) |
248 |
(sort-coding-systems (coding-system-list 'base-only)))))) |
(sort-coding-systems (coding-system-list 'base-only)))))) |
249 |
|
|
|
(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.") |
|
|
|
|
250 |
(defvar mm-coding-system-priorities nil |
(defvar mm-coding-system-priorities nil |
251 |
"Preferred coding systems for encoding outgoing mails. |
"Preferred coding systems for encoding outgoing mails. |
252 |
|
|
455 |
(> (length (memq a mm-coding-system-priorities)) |
(> (length (memq a mm-coding-system-priorities)) |
456 |
(length (memq b mm-coding-system-priorities)))) |
(length (memq b mm-coding-system-priorities)))) |
457 |
|
|
458 |
(defun mm-find-mime-charset-region (b e &optional hack-charsets) |
(defun mm-find-mime-charset-region (b e) |
459 |
"Return the MIME charsets needed to encode the region between B and E. |
"Return the MIME charsets needed to encode the region between B and E. |
460 |
nil means ASCII, a single-element list represents an appropriate MIME |
nil means ASCII, a single-element list represents an appropriate MIME |
461 |
charset, and a longer list means no appropriate charset." |
charset, and a longer list means no appropriate charset." |
481 |
(setq systems nil |
(setq systems nil |
482 |
charsets (list cs)))))) |
charsets (list cs)))))) |
483 |
charsets)) |
charsets)) |
484 |
|
;; Fixme: won't work for unibyte Emacs 22: |
485 |
|
|
486 |
;; Otherwise we're not multibyte, XEmacs or a single coding |
;; Otherwise we're not multibyte, XEmacs or a single coding |
487 |
;; system won't cover it. |
;; system won't cover it. |
488 |
(setq charsets |
(setq charsets |
490 |
(mapcar 'mm-mime-charset |
(mapcar 'mm-mime-charset |
491 |
(delq 'ascii |
(delq 'ascii |
492 |
(mm-find-charset-region b e)))))) |
(mm-find-charset-region b e)))))) |
|
(if (and (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))) |
|
493 |
charsets)) |
charsets)) |
494 |
|
|
495 |
(defmacro mm-with-unibyte-buffer (&rest forms) |
(defmacro mm-with-unibyte-buffer (&rest forms) |