aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2015-09-14 14:09:24 -0700
committerPaul Eggert2015-09-14 14:09:51 -0700
commitb5a3626f316d2c0f1196a9718e51462c09a14568 (patch)
treeed3f7ff147dc1f1ac7f90653f305289f51e3ddb5
parent67ddc7c55d6b40e3d37b2773e002a50123ae7411 (diff)
downloademacs-b5a3626f316d2c0f1196a9718e51462c09a14568.tar.gz
emacs-b5a3626f316d2c0f1196a9718e51462c09a14568.zip
Don’t double-encode non-ASCII mail clipboard
* lisp/mail/mailclient.el (mailclient-send-it): Also fix the case when mailclient-place-body-on-clipboard-flag is non-nil. Problem reported by Eli Zaretskii (Bug#21471#37).
-rw-r--r--lisp/mail/mailclient.el56
1 files changed, 25 insertions, 31 deletions
diff --git a/lisp/mail/mailclient.el b/lisp/mail/mailclient.el
index bef20380b33..2fb944bdc76 100644
--- a/lisp/mail/mailclient.el
+++ b/lisp/mail/mailclient.el
@@ -175,37 +175,31 @@ The mail client is taken to be the handler of mailto URLs."
175 (mailclient-encode-string-as-url subj)) 175 (mailclient-encode-string-as-url subj))
176 "")))) 176 ""))))
177 ;; body 177 ;; body
178 (concat 178 (mailclient-url-delim) "body="
179 (mailclient-url-delim) "body=" 179 (progn
180 (mailclient-encode-string-as-url 180 (delete-region (point-min) delimline)
181 (if mailclient-place-body-on-clipboard-flag 181 (unless (null character-coding)
182 (progn 182 ;; mailto: and clipboard need UTF-8 and cannot deal with
183 (clipboard-kill-ring-save 183 ;; Content-Transfer-Encoding or Content-Type.
184 (+ 1 delimline) (point-max)) 184 ;; FIXME: There is code duplication here with rmail.el.
185 (concat 185 (set-buffer-multibyte nil)
186 "*** E-Mail body has been placed on clipboard, " 186 (cond
187 "please paste it here! ***")) 187 ((string= character-coding "base64")
188 ;; else 188 (base64-decode-region (point-min) (point-max)))
189 (let ((body (buffer-substring (+ 1 delimline) (point-max)))) 189 ((string= character-coding "quoted-printable")
190 (if (null character-coding) 190 (mail-unquote-printable-region (point-min) (point-max)
191 body 191 nil nil t))
192 ;; mailto: requires UTF-8 and cannot deal with 192 (t (error "unsupported Content-Transfer-Encoding: %s"
193 ;; Content-Transfer-Encoding or Content-Type. 193 character-coding)))
194 ;; FIXME: There is a lot of code duplication here 194 (decode-coding-region (point-min) (point-max) coding-system))
195 ;; with rmail.el. 195 (mailclient-encode-string-as-url
196 (erase-buffer) 196 (if mailclient-place-body-on-clipboard-flag
197 (set-buffer-multibyte nil) 197 (progn
198 (insert body) 198 (clipboard-kill-ring-save (point-min) (point-max))
199 (cond 199 (concat
200 ((string= character-coding "quoted-printable") 200 "*** E-Mail body has been placed on clipboard, "
201 (mail-unquote-printable-region (point-min) (point-max) 201 "please paste it here! ***"))
202 nil nil 'unibyte)) 202 (buffer-string)))))))))))
203 ((string= character-coding "base64")
204 (base64-decode-region (point-min) (point-max)))
205 (t (error "unsupported Content-Transfer-Encoding: %s"
206 character-coding)))
207 (decode-coding-region (point-min) (point-max)
208 coding-system t)))))))))))))
209 203
210(provide 'mailclient) 204(provide 'mailclient)
211 205