From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: case-insensitive string comparison Date: Mon, 25 Jul 2022 18:58:19 +0300 Message-ID: <83o7xddw10.fsf@gnu.org> References: <87ilnsq4cr.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4384"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: sds@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jul 25 17:59:03 2022 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 1oG0U3-0000w6-9V for ged-emacs-devel@m.gmane-mx.org; Mon, 25 Jul 2022 17:59:03 +0200 Original-Received: from localhost ([::1]:41304 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oG0U1-0001TY-LA for ged-emacs-devel@m.gmane-mx.org; Mon, 25 Jul 2022 11:59:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48662) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oG0TK-0000ld-Fy for emacs-devel@gnu.org; Mon, 25 Jul 2022 11:58:18 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:49696) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oG0TK-00023t-4t; Mon, 25 Jul 2022 11:58:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=TWGKuX2JVWhuFqJ59fcrdXzlbUZTB1wTMKVMPjwwg8o=; b=qWaYT6f8zFT7ylHSpd3V jNgZWu1uRiyTv/6Wke6I12KNqLMf+3LNSCSpWsmb4EqdY5Elr/0RkOH+F99C5Baxneb8ceS19p2L7 6167iwHGZHGcfFspb9K9gRAQgM0Bw5kks1ESM6yjOjAb5ZaE5nY0gcAxNSvg2rVQWObENOkz6pr7/ Z+ooudOYAJQWaYALacHEo7lI67VqzOOibWAyjU6JLAevKPYGGxRlyjaABcEGHkxjuwL/uaTuS2gpZ hmXnyIhKInYjvhguC9CQXGD4NytLxPLF00tK9+dxJ232gcVObjIhQKSiFTd4HUKEDC5TzzaqYtNb3 Wgqt8ovhPq2npQ==; Original-Received: from [87.69.77.57] (port=1782 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oG0TJ-0003eh-C6; Mon, 25 Jul 2022 11:58:17 -0400 In-Reply-To: (message from Sam Steingold on Mon, 25 Jul 2022 10:23:30 -0400) 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:292639 Archived-At: > From: Sam Steingold > Date: Mon, 25 Jul 2022 10:23:30 -0400 > > >> Hmm... `string-collate-equalp`? > > > > (string-collate-equalp "a" "A" current-locale-environment t) > > ==> nil > > current-locale-environment > > ==> "en_US.UTF-8" I cannot reproduce this: (string-collate-equalp "a" "A" current-locale-environment t) => t current-locale-environment => "en_US.UTF-8" What OS is this, and which Emacs version? > So, how do we do case-insensitive string comparison in Emacs? If you want locale-specific collation, as Stefan said, above. > It is okay to add a `string-equal-ignore-case' based on `compare-strings'? > (even though it does not recognize "SS" and "ß" as equal) What's wrong with calling compare-strings directly? > Or should we first implement something like casefold in Python? > https://docs.python.org/3/library/stdtypes.html#str.casefold Ha! we already have that: (get-char-code-property ?ß 'special-uppercase) => "SS" Give us some credit, yes?