Subject: bug#52792: 27.2; please don't hardcode utf-8 when fetching group list

From: LdBeth <[email-masked]>
Date: Sun, 26 Dec 2021 10:00:42 +0800

This patch that reverts only related changes (and does nothing else)
in cb12a84f2c519a48dd87453c925e3bc36d9944db should make Gnus works
again for none utf-8 NNTP servers.

--- gnus-srvr.el.old	2021-12-26 09:48:28.000000000 +0800
+++ gnus-srvr.el	2021-12-26 09:55:45.000000000 +0800
@@ -784,13 +784,11 @@
 	      (while (not (eobp))
 		(ignore-errors
 		  (push (cons
-			 (decode-coding-string
 			  (buffer-substring
 			   (point)
 			   (progn
 			     (skip-chars-forward "^ \t")
 			     (point)))
-			  'utf-8-emacs)
 			 (let ((last (read cur)))
 			   (cons (read cur) last)))
 			groups))
@@ -798,7 +796,6 @@
 	    (while (not (eobp))
 	      (ignore-errors
 		(push (cons
-		       (decode-coding-string
 			(if (eq (char-after) ?\")
 			    (read cur)
 			  (let ((p (point)) (name ""))
@@ -811,7 +808,6 @@
 			      (setq name (concat name (buffer-substring
 						       p (point)))))
 			    name))
-			'utf-8-emacs)
 		       (let ((last (read cur)))
 			 (cons (read cur) last)))
 		      groups))
@@ -863,7 +859,12 @@
 			   ((= level gnus-level-zombie) ?Z)
 			   (t ?K)))
 			(max 0 (- (1+ (cddr group)) (cadr group)))
-			name)))
+				;; Don't decode if name is ASCII
+			(if (eq (detect-coding-string name t) 'undecided)
+			    name
+			  (decode-coding-string
+			   name
+			   (inline (gnus-group-name-charset method name)))))))
 	     (list 'gnus-group name)
 	     )))
 	(switch-to-buffer (current-buffer)))