;; Copyright (C) 1995,1996,1997 Free Software Foundation, Inc.
;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
-;; Version: $Revision: 0.15 $
+;; Version: $Revision: 0.16 $
;; Keywords: encoded-word, MIME, multilingual, header, mail, news
;; This file is part of SEMI (SEMI is Emacs MIME Interfaces).
;;;
(defconst eword-encode-RCS-ID
- "$Id: eword-encode.el,v 0.15 1997-03-15 20:10:13 morioka Exp $")
+ "$Id: eword-encode.el,v 0.16 1997-03-27 21:42:08 morioka Exp $")
(defconst eword-encode-version (get-version-string eword-encode-RCS-ID))
;;; @ application interfaces
;;;
-(defun eword-encode-field (str)
- (setq str (std11-unfold-string str))
- (let ((ret (string-match std11-field-head-regexp str)))
+(defun eword-encode-field (string)
+ "Encode header field STRING, and return the result.
+A lexical token includes non-ASCII character is encoded as MIME
+encoded-word. ASCII token is not encoded."
+ (setq string (std11-unfold-string string))
+ (let ((ret (string-match std11-field-head-regexp string)))
(or (if ret
- (let ((field-name (substring str 0 (1- (match-end 0))))
+ (let ((field-name (substring string 0 (1- (match-end 0))))
(field-body (eliminate-top-spaces
- (substring str (match-end 0))))
- fname)
+ (substring string (match-end 0))))
+ )
(if (setq ret
(cond ((string-equal field-body "") "")
- ((member (setq fname (downcase field-name))
- '("reply-to" "from" "sender"
- "resent-reply-to" "resent-from"
- "resent-sender" "to" "resent-to"
- "cc" "resent-cc"
- "bcc" "resent-bcc" "dcc")
- )
+ ((memq (intern (downcase field-name))
+ '(reply-to
+ from sender
+ resent-reply-to resent-from
+ resent-sender to resent-to
+ cc resent-cc
+ bcc resent-bcc dcc)
+ )
(car (tm-eword::encode-address-list
(+ (length field-name) 2) field-body))
)
(t
(car (tm-eword::encode-string
- (+ (length field-name) 1)
+ (1+ (length field-name))
field-body 'text))
))
)
(concat field-name ": " ret)
)))
- (car (tm-eword::encode-string 0 str))
+ (car (tm-eword::encode-string 0 string))
)))
(defun eword-in-subject-p ()