From: Lars Ingebrigtsen Date: Thu, 20 Aug 2020 14:42:06 +0000 (+0200) Subject: Add a new way to encode unprintable characters in Message: url-encode X-Git-Tag: emacs-28.0.90~6493 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b19b942f7228cf9536f3cf5b279b93a83d2a7d64;p=emacs.git Add a new way to encode unprintable characters in Message: url-encode * lisp/gnus/message.el (message-fix-before-sending): Add a new conversion method for invalid characters -- URL-encoding (bug#38955). --- diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 0fd490be5c0..8ae5eb2f625 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -4466,6 +4466,7 @@ conformance." ,(format "Replace non-printable characters with \"%s\" and send" message-replacement-char)) + (?u "url-encode" "Use URL %hex encoding") (?s "send" "Send as is without removing anything") (?e "edit" "Continue editing"))))) (if (eq choice ?e) @@ -4487,11 +4488,17 @@ conformance." control-1)) (not (get-text-property (point) 'untranslated-utf-8))))) - (if (eq choice ?i) - (message-kill-all-overlays) + (cond + ((eq choice ?i) + (message-kill-all-overlays)) + ((eq choice ?u) + (let ((char (get-byte (point)))) + (delete-char 1) + (insert (format "%%%x" char)))) + (t (delete-char 1) (when (eq choice ?r) - (insert message-replacement-char)))) + (insert message-replacement-char))))) (forward-char) (skip-chars-forward mm-7bit-chars))))) (message-check 'bogus-recipient