From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?UTF-8?Q?=C5=81ukasz?= Stelmach Newsgroups: gmane.emacs.bugs Subject: bug#41511: [PATCH] Decode group name before matching against gnus-parameters Date: Sun, 24 May 2020 18:59:40 +0200 Message-ID: <20200524165940.13507-1-stlman@poczta.fm> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="103260"; mail-complaints-to="usenet@ciao.gmane.io" Cc: =?UTF-8?Q?=C5=81ukasz?= Stelmach To: 41511@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 24 19:01:13 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1jctzt-000Qn2-71 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 24 May 2020 19:01:13 +0200 Original-Received: from localhost ([::1]:42892 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jctzs-0003EO-4U for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 24 May 2020 13:01:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54954) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jctzj-0003Bp-3L for bug-gnu-emacs@gnu.org; Sun, 24 May 2020 13:01:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55251) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jctzi-00011C-Ol for bug-gnu-emacs@gnu.org; Sun, 24 May 2020 13:01:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jctzi-00031O-Mz for bug-gnu-emacs@gnu.org; Sun, 24 May 2020 13:01:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?=C5=81ukasz?= Stelmach Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 24 May 2020 17:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 41511 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.159033962211556 (code B ref -1); Sun, 24 May 2020 17:01:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 May 2020 17:00:22 +0000 Original-Received: from localhost ([127.0.0.1]:38564 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jctz3-00030K-Vz for submit@debbugs.gnu.org; Sun, 24 May 2020 13:00:22 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:43674) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jctz2-00030D-OI for submit@debbugs.gnu.org; Sun, 24 May 2020 13:00:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54902) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jctz2-0002Us-Fe for bug-gnu-emacs@gnu.org; Sun, 24 May 2020 13:00:20 -0400 Original-Received: from smtpo.poczta.interia.pl ([217.74.65.233]:40320) by eggs.gnu.org with esmtps (TLS1.2:RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jctyz-0000o3-5t for bug-gnu-emacs@gnu.org; Sun, 24 May 2020 13:00:19 -0400 X-Interia-R: Interia X-Interia-R-IP: 185.220.101.9 X-Interia-R-Helo: Original-Received: from localhost (unknown [185.220.101.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by www.poczta.fm (INTERIA.PL) with ESMTPSA; Sun, 24 May 2020 19:00:10 +0200 (CEST) X-Mailer: git-send-email 2.20.1 X-Interia-Antivirus: OK DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=interia.pl; s=biztos; t=1590339611; bh=d4JbX1q+7PY2VbwgPEFNKps9HOnVs942HtNGTBVmKMM=; h=X-Interia-R:X-Interia-R-IP:X-Interia-R-Helo:From:To:Cc:Subject: Date:Message-Id:X-Mailer:MIME-Version:Content-Type: Content-Transfer-Encoding:X-Interia-Antivirus; b=l8ry7A6KJ9n317+WDrboJodUciXK9sMQUSfuraGgcsJAGmzgVXpdAxbexyEOmz79D ueNslolse7hpRMsjqHbES3Qp3M2iNzOhykZNPUvXnCq6vuyM9RhFzsdZvdsGFh/Hoy Id1z9oTidmbwSLgDyZA7wyausx1ycCbo44FJ0fnY= Received-SPF: pass client-ip=217.74.65.233; envelope-from=stlman@poczta.fm; helo=smtpo.poczta.interia.pl X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/24 13:00:12 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x (no timestamps) [generic] X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_BL_SPAMCOP_NET=1.347, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:180909 Archived-At: Group names in Gnus are stored and processed as strings of bytes (e.g. "Wiadomo\305\233ci-\305\233mieci") while regular expressions in gnus-parameters are encoded as multibyte strings (e.g. "Wiadomości-śmieci") and matching the latter aginst the former doesn't work. Parameters set for groups with non-ascii characters in their names cannot be retrieved. To fix this problem group name needs to be decoded before being matched against a regexp. * gnus.el (gnus-parameters-get-parameter, gnus-group-fast-parameter, gnus-define-group-parameter): Decode a group name before matching against a regexp. --- lisp/gnus/gnus.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el index caeab7f55a..e7621872d8 100644 --- a/lisp/gnus/gnus.el +++ b/lisp/gnus/gnus.el @@ -947,6 +947,7 @@ REST is a plist of following: (string-match ,variable name)) (,variable (let ((alist ,variable) + (decoded-name (gnus-group-decoded-name name)) elem value) (while (setq elem (pop alist)) (when (and name @@ -959,6 +960,7 @@ REST is a plist of following: (and name (or (gnus-group-find-parameter name ',param ,(and type t)) (let ((alist ,variable) + (decoded-name (gnus-group-decoded-name name)) elem value) (while (setq elem (pop alist)) (when (and name @@ -3513,9 +3515,10 @@ You should probably use `gnus-find-method-for-group' instead." (let ((case-fold-search (if (eq gnus-parameters-case-fold-search 'default) case-fold-search gnus-parameters-case-fold-search)) + (decoded-group (gnus-group-decoded-name group)) params-list) (dolist (elem gnus-parameters) - (when (string-match (car elem) group) + (when (string-match (car elem) decoded-group) (setq params-list (nconc (gnus-expand-group-parameters (car elem) (cdr elem) group) @@ -3569,7 +3572,8 @@ The function `gnus-group-find-parameter' will do that for you." (let* ((params (funcall gnus-group-get-parameter-function group)) ;; Start easy, check the "real" group parameters. (simple-results - (gnus-group-parameter-value params symbol allow-list t))) + (gnus-group-parameter-value params symbol allow-list t)) + (decoded-group (gnus-group-decoded-name group))) (if simple-results ;; Found results; return them. (car simple-results) @@ -3582,7 +3586,7 @@ The function `gnus-group-find-parameter' will do that for you." (setq head (car tail) tail (cdr tail)) ;; The car is regexp matching for matching the group name. - (when (string-match (car head) group) + (when (string-match (car head) decoded-group) ;; The cdr is the parameters. (let ((this-result (gnus-group-parameter-value (cdr head) symbol allow-list t))) -- 2.20.1