8 (defun ew-b-check (encoding encoded-text) (string-match ew-b-regexp encoded-text))
9 (defun ew-q-check (encoding encoded-text) (string-match ew-q-regexp encoded-text))
11 (defsubst ew-eword-p (str)
12 (let ((len (length str)))
17 (eq (aref str (- len 2)) ??)
18 (eq (aref str (1- len)) ?=))))
20 (defun ew-decode-eword (str)
21 (if (string-match ew-anchored-encoded-word-regexp str)
22 (let ((charset (match-string 1 str))
23 (encoding (match-string 2 str))
24 (encoded-text (match-string 3 str))
28 (if (or ew-permit-null-encoded-text
29 (< 0 (length encoded-text)))
30 (if (and (setq bdec (ew-byte-decoder encoding))
31 (setq cdec (ew-char-decoder charset)))
32 (if (or (null (setq bcheck (ew-byte-checker encoding)))
33 (funcall bcheck encoding encoded-text))
34 (ew-quote (closure-call cdec (funcall bdec encoded-text)))
36 (ew-quote-eword charset encoding encoded-text))
40 (defun ew-byte-decoder (encoding)
41 (cdr (assoc (upcase encoding) ew-byte-decoder-alist)))
43 (defun ew-byte-checker (encoding)
44 (cdr (assoc (upcase encoding) ew-byte-checker-alist)))
46 (defun ew-char-decoder (charset)
47 (let ((sym (intern (downcase charset))))
48 (when (mime-charset-to-coding-system sym 'LF)
50 (lambda (str) (decode-mime-charset-string str sym 'LF))