From e73b8ae86f09b34a65086641d693aea78e42fb25 Mon Sep 17 00:00:00 2001 From: Eric Abrahamsen Date: Mon, 25 Oct 2021 09:39:52 -0700 Subject: [PATCH] IMAP search should only use charset utf-8 with multibyte strings Background: Exchange servers cannot accept "charset utf-8" search strings. The code originally set that charset for any server with literal+ capability, borking all searches on an Exchange server. This code only sets utf-8 for multibyte search strings in particular, which would be borken for Exchange anyway. * lisp/gnus/gnus-search.el (gnus-search-imap-search-command): Ensure we're only doing the literal+ dance for multibyte strings (multibyte strings will have had newlines inserted in an earlier step). --- lisp/gnus/gnus-search.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el index 9c83d5fa376..31573588046 100644 --- a/lisp/gnus/gnus-search.el +++ b/lisp/gnus/gnus-search.el @@ -1084,7 +1084,8 @@ Responsible for handling and, or, and parenthetical expressions.") Currently takes into account support for the LITERAL+ capability. Other capabilities could be tested here." (with-slots (literal-plus) engine - (when literal-plus + (when (and literal-plus + (string-match-p "\n" query)) (setq query (split-string query "\n"))) (cond ((consp query) -- 2.39.2