Subject: bug#35219: 27.0.50; Problems with nnimap groups with non-ASCII characters

From: Eric Abrahamsen <[email-masked]>
Date: Sun, 14 Apr 2019 19:19:44 -0700

Eric Abrahamsen <[email-masked]> writes:

> Lars Ingebrigtsen <[email-masked]> writes:
>
>> This started showing up yesterday after recent changes in Gnus:
>>
>> To reproduce: Create an nnimap group called "Tést".  Restarting Gnus
>> will properly create the group "Tést", but Gnus will also say
>>
>> nnimap read 12k from quimby.gnus.org (initial sync of 3 groups; please wait)
>>
>> If you then quit Gnus and restart Gnus, this group will appear:
>>
>>        *: nnimap+quimby.gnus.org:T\351st
>>
>> If you try to kill it, all the groups in the buffer will disappear.
>>
>> So something went wrong during whatever the most recent group-related
>> changes were.  :-)
>
> Gaah... I've got a pile of tests in place for exactly this! Give me a
> bit and I'll try to reproduce.

Lars, would you give this a shot? I should only have been messing with
encoding for group names that were coming from symbols.

Thanks,
Eric

diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el
index 2beb685822..606155d741 100644
--- a/lisp/gnus/gnus-start.el
+++ b/lisp/gnus/gnus-start.el
@@ -2146,14 +2146,14 @@ gnus-active-to-gnus-format
 	    (if (and (stringp (progn
 				(setq group (read cur)
 				      group
-				      (encode-coding-string
-				       (cond ((numberp group)
-					      (number-to-string group))
-					     ((symbolp group)
-					      (symbol-name group))
-					     ((stringp group)
-					      group))
-				       'latin-1))))
+				      (cond ((numberp group)
+					     (number-to-string group))
+					    ((symbolp group)
+					     (encode-coding-string
+					      (symbol-name group)
+					      'latin-1))
+					    ((stringp group)
+					     group)))))
 		     (numberp (setq max (read cur)))
 		     (numberp (setq min (read cur)))
 		     (null (progn