+1998-04-25 Tanaka Akira <shuhei-k@jaist.ac.jp>
+
+ * eword-decode.el (eword-decode-entire-string): Delete argument
+ `default-charset'. Add argument `code-conversion'.
+ (eword-decode-unstructured): Add argument `code-conversion'.
+ (eword-decode-comment): Add argument `code-conversion'.
+ (eword-decode-quoted-string): Add argument `code-conversion'.
+ (eword-decode-string): Propagate `code-conversion' to
+ `eword-decode-unstructured'.
+ (eword-decode-region): Propagate `code-conversion' to
+ `eword-decode-unstructured'.
+
1998-04-23 Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp>
* eword-decode.el (eword-decode-ignored-field-list): Add
if there are in decoded encoded-words (generated by bad manner MUA
such as a version of Net$cape)."
(if eword-decode-sticked-encoded-word (setq after-regexp ""))
- (let ((between-ewords-regexp
- (if eword-decode-sticked-encoded-word
- "\\(\n?[ \t]\\)*"
- "\\(\n?[ \t]\\)+"))
- (src string) ; sequence of octets.
- (dst "")) ; sequence of characters.
- (if (string-match
- (concat "\\`\\(" eword-regexp "\\)" after-regexp) src)
+ (let* ((between-ewords-regexp
+ (if eword-decode-sticked-encoded-word
+ "\\(\n?[ \t]\\)*"
+ "\\(\n?[ \t]\\)+"))
+ (between-ewords-eword-after-regexp
+ (concat "\\`\\(" between-ewords-regexp "\\)"
+ "\\(" eword-regexp "\\)"
+ after-regexp))
+ (eword-after-regexp
+ (concat "\\`\\(" eword-regexp "\\)" after-regexp))
+ (src string) ; sequence of octets.
+ (dst "")) ; sequence of characters.
+ (if (string-match eword-after-regexp src)
(let* (p
(q (match-end 1))
(ew (substring src 0 q))
(progn
(while
(and
- (string-match
- (concat "\\`\\(" between-ewords-regexp "\\)"
- "\\(" eword-regexp "\\)"
- after-regexp)
- src)
+ (string-match between-ewords-eword-after-regexp src)
(progn
(setq p (match-end 1)
q (match-end 3)
safe-regexp
escape ; ?\\ or nil.
delimiters ; list of chars.
- default-charset
- must-unfold)
- (let ((dst "")
+ must-unfold
+ code-conversion)
+ (if (and code-conversion
+ (not (mime-charset-to-coding-system code-conversion)))
+ (setq code-conversion default-mime-charset))
+ (let ((equal-safe-regexp (concat "\\`=?" safe-regexp))
+ (dst "")
(buf "")
(src string)
(ew-enable t))
(or decoded (memq ch delimiters)))
(setq dst (concat dst
(std11-wrap-as-quoted-pairs
- (decode-mime-charset-string buf default-charset)
+ (decode-mime-charset-string buf code-conversion)
delimiters))
buf ""))
(cond
(setq buf (concat buf (substring src 0 (match-end 0)))
src (substring src (match-end 0))
ew-enable t))
- ((and (string-match (concat "\\`=?" safe-regexp) src)
+ ((and (string-match equal-safe-regexp src)
(< 0 (match-end 0)))
(setq buf (concat buf (substring src 0 (match-end 0)))
src (substring src (match-end 0))
(if (not (string= buf ""))
(setq dst (concat dst
(std11-wrap-as-quoted-pairs
- (decode-mime-charset-string buf default-charset)
+ (decode-mime-charset-string buf code-conversion)
delimiters))))
dst))
;;; @ for string
;;;
-(defun eword-decode-unstructured (string &optional must-unfold)
+(defun eword-decode-unstructured (string &optional must-unfold code-conversion)
(eword-decode-entire-string
string
eword-encoded-word-in-unstructured-regexp
"[^ \t\n=]*"
nil
nil
- default-mime-charset
- must-unfold))
+ must-unfold
+ code-conversion))
-(defun eword-decode-comment (string &optional must-unfold)
+(defun eword-decode-comment (string &optional must-unfold code-conversion)
(eword-decode-entire-string
string
eword-encoded-word-in-comment-regexp
"[^ \t\n()\\\\=]*"
?\\
'(?\( ?\))
- default-mime-charset
- must-unfold))
+ must-unfold
+ code-conversion))
-(defun eword-decode-quoted-string (string &optional must-unfold)
+(defun eword-decode-quoted-string (string &optional must-unfold code-conversion)
(eword-decode-entire-string
string
eword-encoded-word-in-quoted-string-regexp
"[^ \t\n\"\\\\=]*"
?\\
'(?\")
- default-mime-charset
- must-unfold))
+ must-unfold
+ code-conversion))
-(defun eword-decode-string (string &optional must-unfold default-mime-charset)
+(defun eword-decode-string (string &optional must-unfold code-conversion)
"Decode MIME encoded-words in STRING.
STRING is unfolded before decoding.
such as a version of Net$cape)."
(eword-decode-unstructured
(std11-unfold-string string)
- must-unfold))
+ must-unfold
+ code-conversion))
;;; @ for region
;;;
(defun eword-decode-region (start end &optional unfolding must-unfold
- default-mime-charset)
+ code-conversion)
"Decode MIME encoded-words in region between START and END.
If UNFOLDING is not nil, it unfolds before decoding.
)
(let ((str (eword-decode-unstructured
(buffer-substring (point-min) (point-max))
- must-unfold)))
+ must-unfold
+ code-conversion)))
(delete-region (point-min) (point-max))
(insert str)))))
code-conversion)
(goto-char (point-max))
)))))
- (eword-decode-region (point-min) (point-max) t nil code-conversion)
+ (eword-decode-region (point-min) (point-max) t nil nil)
))))
(defun eword-decode-unfold ()