From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: LdBeth Newsgroups: gmane.emacs.devel Subject: [PATCH] Gnus; Restore multi encoding support for NNTP Date: Thu, 30 Dec 2021 18:23:08 +0800 Message-ID: References: <87wnjqb62b.fsf@gnus.org> <87sfueb3y1.fsf@gnus.org> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: multipart/mixed; boundary="Multipart_Thu_Dec_30_18:23:08_2021-1" Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21288"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.2 (x86_64-apple-darwin18.7.0) MULE/6.0 (HANACHIRUSATO) Cc: Eric Abrahamsen , Lars Ingebrigtsen To: Emacs Devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Dec 30 11:24:09 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n2sbQ-0005MJ-8B for ged-emacs-devel@m.gmane-mx.org; Thu, 30 Dec 2021 11:24:08 +0100 Original-Received: from localhost ([::1]:60086 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n2sbO-0007QU-TK for ged-emacs-devel@m.gmane-mx.org; Thu, 30 Dec 2021 05:24:06 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:54984) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n2saq-0006jU-Oc for emacs-devel@gnu.org; Thu, 30 Dec 2021 05:23:32 -0500 Original-Received: from out203-205-221-210.mail.qq.com ([203.205.221.210]:48256) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n2saf-0008To-8r for emacs-devel@gnu.org; Thu, 30 Dec 2021 05:23:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1640859792; bh=fgndCXikosHFTaFJXSqAFQ7dx8r5+ES5OUNkNtd/XT8=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=vdP8Krhiu6NpN412q9jeJZlX5x0yoCBXYNhFz2DJpW3n1F11V++CTrL36HeMnQCWm Fmgfk7IsaHXsWDJ1Poj2NQ9lnO06f09VNrRRIIefZTggB6oZwdtMUjGN4C3z/b44yO rX53ZU8QZqs9xgmJtTz7vSPZHCFU+NMofYk/7V1c= Original-Received: from Costume-Party.local ([61.174.174.112]) by newxmesmtplogicsvrszc8.qq.com (NewEsmtp) with SMTP id 5CAAD0B8; Thu, 30 Dec 2021 18:23:10 +0800 X-QQ-mid: xmsmtpt1640859790t1kwlu49m X-QQ-XMAILINFO: N4Cll9NVUEEqFy1f1B/htzMfHZhRGiJaPMCIFyz1tSEBnRDk7sPK8VpgnD1fwW fD0L+DCbsWkyPqRfRuU1iH+mfSsnPGNtxrlC5I6Q78dBT1ZzEvJvTpmuJV10HJ8U5EWcLFZcuVAJ 7+YYqNnIGJ+XXzd73HpKf7j5g9cNjYPjX+sKBH5L1ckO7zciZNicmtx/j+J1UV9bR2E7KoiNTsSm AiPOlXGzO9XIYu478xKLbGyt1kJMkMLrOlFcRymOopsFqPKeskzCxuNGKUz8d23nQJlZK6qBPD+H r2d/FGc3EvFxEnbD0tLx/Hsd6mbVACRXhukn6e6mj6H6zWnrCe5c/jSR+mphXQlVDqXoaVAPZmA4 hdJH8pxoOkL0GfaKelHeMpPiDvSfCSBc2LjivFR5EnJaPAw6ged8lnlsc3x+OIsem/GOq9oKwx6q mdCV/b/cVTbinrDkvBTlwSL3SSBL2khTLZbRKgbEZZ1JTpgwOYMrLMMO9BrtG+OQuasE8wvAqFsR 0OQi4VMD1ubFdB2g16SRkYEpLn6Bdstv5U7OnRM4YZ9uImAzYfmdTNa69cBz5wmCFu5+5U4yVie0 ZidlWGJb2H9r/LOxdqm/CeCWYsHX9Rp5nRhrD+nW42/7amRXqH682ASjwj3MWQi5Q1Q/JdGjeoUU H6eTARoT/x0ADjtFwOGApRuFwc8RqGJhYRSNJw54MmhJMrIoNMflPyltqV8cv/VA0erIIh+I1EJV Zvwn4U3IppavyII9MZYOpRu4hDD5cqYzWLyO7XmblXg7sdChHMFRxdGnyZ+3BpgBinKZcojEXtHG +jabcQaRq3aRNkDLAJCz/Kg+plwcoOyNKKn34tiR Original-Received: by Costume-Party.local (Postfix, from userid 501) id 81F51203D5D30D; Thu, 30 Dec 2021 18:23:08 +0800 (CST) X-OQ-MSGID: In-Reply-To: X-Face: %[!P\u/BKFRGn_9h9|yO"ho?C0ej^LmM}WMb-`Jfj8OsS^^AKmHYGlD@^|7SEA3UzOGPFbB"OFczY?'\JtJ\lR'@&Y5j; s8{$&|3D>^i.U4l2h?1qpD.+{[$~j]vBeHZf^|BGyL8{/`4 X-Attribution: ldb Received-SPF: pass client-ip=203.205.221.210; envelope-from=andpuke@foxmail.com; helo=out203-205-221-210.mail.qq.com X-Spam_score_int: 27 X-Spam_score: 2.7 X-Spam_bar: ++ X-Spam_report: (2.7 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HELO_DYNAMIC_IPADDR=1.951, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, RDNS_DYNAMIC=0.982, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:283636 Archived-At: --Multipart_Thu_Dec_30_18:23:08_2021-1 Content-Type: text/plain; charset=US-ASCII Hi, This patch is intended to fix bug #52792. This uses `gnus-group-name-charset' to decode group names when fetching from **NNTP server only**, `gnus-group-real-name` is modified to decode group names based on their attached `charset' text property. It is expected that when Gnus saves group names to ~/.newsrc.eld, the text properties are correctly saved. If we can assure only NNTP needs this special encoding, I may move the coding coversion to nntp.el instead, and fix `gnus-group-name-charset'. -- LDB --Multipart_Thu_Dec_30_18:23:08_2021-1 Content-Type: text/plain; type=patch; name="gnus.patch"; charset=US-ASCII Content-Disposition: attachment; filename="gnus.patch" diff --git a/gnus-group.el b/gnus-group.el index 2ec001f..c990158 100644 --- a/gnus-group.el +++ b/gnus-group.el @@ -1197,6 +1197,9 @@ The following commands are available: ;; FIXME: If we never have to coerce group names to unibyte now, how ;; much of this is necessary? How much encoding/decoding do we still ;; have to do? +;; At least, nntp method still needs this. +;; Maybe we can just reduce this function to just lookup +;; `gnus-group-name-charset-group-alist'. (defun gnus-group-name-charset (method group) (unless method (setq method (gnus-find-method-for-group group))) diff --git a/gnus-srvr.el b/gnus-srvr.el index fa880b7..39a94c1 100644 --- a/gnus-srvr.el +++ b/gnus-srvr.el @@ -775,13 +775,17 @@ claim them." (while (not (eobp)) (ignore-errors (push (cons - (decode-coding-string - (buffer-substring - (point) - (progn - (skip-chars-forward "^ \t") - (point))) - 'utf-8-emacs) + (let ((name + (buffer-substring + (point) + (progn + (skip-chars-forward "^ \t") + (point))))) + (if (eq (detect-coding-string name t) 'undecided) + name + (decode-coding-string + name + (inline (gnus-group-name-charset method name))))) (let ((last (read cur))) (cons (read cur) last))) groups)) diff --git a/gnus-util.el b/gnus-util.el index 8dbdcc8..f204e81 100644 --- a/gnus-util.el +++ b/gnus-util.el @@ -622,9 +622,9 @@ If N, return the Nth ancestor instead." (defmacro gnus-group-real-name (group) "Find the real name of a foreign newsgroup." `(let ((gname ,group)) - (if (string-match "^[^:]+:" gname) - (substring gname (match-end 0)) - gname))) + (encode-coding-string (if (string-match "^[^:]+:" gname) + (substring gname (match-end 0)) + (get-text-property 0 'charset gname))))) (defmacro gnus-group-server (group) "Find the server name of a foreign newsgroup. --Multipart_Thu_Dec_30_18:23:08_2021-1--