From b19b942f7228cf9536f3cf5b279b93a83d2a7d64 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 20 Aug 2020 16:42:06 +0200 Subject: [PATCH] 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). --- lisp/gnus/message.el | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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 -- 2.39.2