-;; Emacs 18 implementations
-
-(defun mime-string-encoder-for-emacs18 (method string)
- "For given METHOD that is a cons of charset and encoding, encode a STRING."
- (let ((charset (car method))
- (encoding (cdr method)))
- (cond ((stringp encoding)
- (mime-encode-string encoding string))
- ;; Return string without any encoding.
- (t string)
- )))
-
-\f
-;; Emacs 19 implementations
-
-(defun mime-string-encoder-for-emacs19 (method string)
- "For given METHOD that is a cons of charset and encoding, encode a STRING."
- (let ((charset (car method))
- (encoding (cdr method)))
- (cond ((stringp encoding)
- (mime-encode-string encoding string))
- ;; Return string without any encoding.
- (t string)
- )))
-
-\f
-;; NEmacs implementations
-
-(defun mime-string-encoder-for-nemacs (method string)
- "For given METHOD that is a cons of charset and encoding, encode a STRING.
-US-ASCII and ISO-2022-JP are supported on NEmacs."
- (let ((charset (car method))
- (encoding (cdr method)))
- (cond ((stringp encoding)
- (mime-encode-string encoding
- ;; Convert internal (EUC) to JIS code.
- (convert-string-kanji-code string 3 2)
- ))
- ;; NEmacs can convert into ISO-2022-JP automatically,
- ;; but can do it myself as follows:
- ;;(t (convert-string-kanji-code string 3 2))
-
- ;; Return string without any encoding.
- (t string)
- )))
-
-\f
-;; Mule implementations
-;; Thanks to contributions by wkenji@flab.fujitsu.co.jp (Kenji
-;; WAKAMIYA) and handa@etl.go.jp (Kenichi Handa).
-
-(defun mime-string-encoder-for-mule (method string)
- "For given METHOD that is a cons of charset and encoding, encode a
-STRING. US-ASCII, ISO-8859-* (except for ISO-8859-6), ISO-2022-JP,
-ISO-2022-JP-2 and ISO-2022-INT-1 are supported on Mule. Either of
-charset ISO-2022-JP-2 or ISO-2022-INT-1 is used for multilingual
-text."
- (let* ((charset (car method))
- (encoding (cdr method))
- (coding-system
- (cdr (assoc (and (stringp charset) (upcase charset))
- '(("ISO-8859-1" . *ctext*)
- ("ISO-8859-2" . *iso-8859-2*)
- ("ISO-8859-3" . *iso-8859-3*)
- ("ISO-8859-4" . *iso-8859-4*)
- ("ISO-8859-5" . *iso-8859-5*)
- ;;("ISO-8859-6" . *iso-8859-6*)
- ("ISO-8859-7" . *iso-8859-7*)
- ("ISO-8859-8" . *iso-8859-8*)
- ("ISO-8859-9" . *iso-8859-9*)
- ("ISO-2022-JP" . *junet*)
- ("ISO-2022-JP-2" . *iso-2022-ss2-7*)
- ("ISO-2022-KR" . *korean-mail*)
- ("ISO-2022-INT-1" . *iso-2022-int-1*)
- )))))
- ;; In bilingual environment it may be unnecessary to convert the
- ;; coding system of the string unless transfer encoding is
- ;; required since such conversion may be performed by mule
- ;; automatically.
- (if (not (null coding-system))
- (setq string (code-convert-string string *internal* coding-system)))
- (if (stringp encoding)
- (setq string (mime-encode-string encoding string)))
- string
- ))
-
-\f