aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2004-03-04 17:02:13 +0000
committerRichard M. Stallman2004-03-04 17:02:13 +0000
commit926f20041fc4d5cdaa94737117a236be2744cd02 (patch)
treee9ee1551ccbf8d37e72f89a34634224436eed82f
parent5bb54c616f442f29e9241bd920a15f8a4d5f0432 (diff)
downloademacs-926f20041fc4d5cdaa94737117a236be2744cd02.tar.gz
emacs-926f20041fc4d5cdaa94737117a236be2744cd02.zip
(mail-unquote-printable-region): New arg UNIBYTE.
-rw-r--r--lisp/mail/mail-utils.el25
1 files changed, 16 insertions, 9 deletions
diff --git a/lisp/mail/mail-utils.el b/lisp/mail/mail-utils.el
index 96a57b38f07..aecc87cf178 100644
--- a/lisp/mail/mail-utils.el
+++ b/lisp/mail/mail-utils.el
@@ -108,11 +108,15 @@ we expect to find and remove the wrapper characters =?ISO-8859-1?Q?....?=."
108 (apply 'concat (nreverse (cons (substring string i) strings)))))) 108 (apply 'concat (nreverse (cons (substring string i) strings))))))
109 109
110;;;###autoload 110;;;###autoload
111(defun mail-unquote-printable-region (beg end &optional wrapper noerror) 111(defun mail-unquote-printable-region (beg end &optional wrapper noerror
112 unibyte)
112 "Undo the \"quoted printable\" encoding in buffer from BEG to END. 113 "Undo the \"quoted printable\" encoding in buffer from BEG to END.
113If the optional argument WRAPPER is non-nil, 114If the optional argument WRAPPER is non-nil,
114we expect to find and remove the wrapper characters =?ISO-8859-1?Q?....?=. 115we expect to find and remove the wrapper characters =?ISO-8859-1?Q?....?=.
115If NOERROR is non-nil, return t if successful." 116If NOERROR is non-nil, return t if successful.
117If UNIBYTE is non-nil, insert converted characters as unibyte.
118That is useful if you are going to character code decoding afterward,
119as Rmail does."
116 (interactive "r\nP") 120 (interactive "r\nP")
117 (let (failed) 121 (let (failed)
118 (save-match-data 122 (save-match-data
@@ -131,13 +135,16 @@ If NOERROR is non-nil, return t if successful."
131 ((= (char-after (match-beginning 1)) ?=) 135 ((= (char-after (match-beginning 1)) ?=)
132 (replace-match "=")) 136 (replace-match "="))
133 ((match-beginning 2) 137 ((match-beginning 2)
134 (replace-match 138 (let ((char (+ (* 16 (mail-unquote-printable-hexdigit
135 (make-string 1 139 (char-after (match-beginning 2))))
136 (+ (* 16 (mail-unquote-printable-hexdigit 140 (mail-unquote-printable-hexdigit
137 (char-after (match-beginning 2)))) 141 (char-after (1+ (match-beginning 2)))))))
138 (mail-unquote-printable-hexdigit 142 (if unibyte
139 (char-after (1+ (match-beginning 2)))))) 143 (progn
140 t t)) 144 (replace-match "")
145 ;; insert-char will insert this as unibyte,
146 (insert-char char 1))
147 (replace-match (make-string 1 char) t t))))
141 (noerror 148 (noerror
142 (setq failed t)) 149 (setq failed t))
143 (t 150 (t