From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#58168: string-lessp glitches and inconsistencies Date: Fri, 30 Sep 2022 22:04:47 +0200 Message-ID: <6CB805F6-89EE-4D7C-A398-F29698733A42@gmail.com> References: <7824372D-8002-4639-8AEE-E80A6D5FEFC6@gmail.com> <83czbef6le.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31907"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58168@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 30 22:05:56 2022 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 1oeMGh-00086Q-JI for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 30 Sep 2022 22:05:55 +0200 Original-Received: from localhost ([::1]:43702 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oeMGg-0006jV-BZ for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 30 Sep 2022 16:05:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59574) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oeMFq-0006jN-MJ for bug-gnu-emacs@gnu.org; Fri, 30 Sep 2022 16:05:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43938) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oeMFq-00024F-DR for bug-gnu-emacs@gnu.org; Fri, 30 Sep 2022 16:05:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oeMFq-0003FQ-1c for bug-gnu-emacs@gnu.org; Fri, 30 Sep 2022 16:05:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 30 Sep 2022 20:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58168 X-GNU-PR-Package: emacs Original-Received: via spool by 58168-submit@debbugs.gnu.org id=B58168.166456830012473 (code B ref 58168); Fri, 30 Sep 2022 20:05:02 +0000 Original-Received: (at 58168) by debbugs.gnu.org; 30 Sep 2022 20:05:00 +0000 Original-Received: from localhost ([127.0.0.1]:43016 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oeMFn-0003F7-IP for submit@debbugs.gnu.org; Fri, 30 Sep 2022 16:04:59 -0400 Original-Received: from mail-lj1-f179.google.com ([209.85.208.179]:40650) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oeMFj-0003Es-UQ for 58168@debbugs.gnu.org; Fri, 30 Sep 2022 16:04:58 -0400 Original-Received: by mail-lj1-f179.google.com with SMTP id g20so5891124ljg.7 for <58168@debbugs.gnu.org>; Fri, 30 Sep 2022 13:04:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:from:to:cc:subject :date; bh=TgCBP6TvfS+mIRfqy1Q9IBD4YBC1ohxvxtsgGWdt1A0=; b=B3yEccpmedKPdShkNt/hFL2jNv+RJM7DyOEqBcklhW2pTIOkXndLJYIJn/hZ67AR93 9JYJtGf3GqwcsN/HZmMXg05oRw5pRlTvECYwOzP2WGFZUlOFRz/JOY+55/tKWOx291ms MhFiwAj/lgc1c8jFRqZ1FVXn0PZaIvBroeIrMJw93UMKoGN8t/jFsXuAVzY1ZR5Li9eo 5Dq/btFlDbakzxhAYrDvfcXOuQfqNO3O59i1eL6sElvA7mNCAYCV1DldUuD7gQq5OOnu WEkDLHbhpHHOY00dZ2Xtpkcj2Voo7xfkiDR7Heyae3On4lY2LIz8dYnn4TQx919PwsRg psYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:x-gm-message-state :from:to:cc:subject:date; bh=TgCBP6TvfS+mIRfqy1Q9IBD4YBC1ohxvxtsgGWdt1A0=; b=Qt/XNSFoi1hC/0DwibgcE0wMlOEvcPUXfAIh3HJ29rCEZTtyCGb2mhuEMicWttg8RP f8fjPZCiPeDR7lRc0rlIQaSDRKZ9XJRxfEbKVsd060KZt/0Cwz5rTMj386Up9JKLbHSD 8UgUsAlpUdf7fvbFY1c0eoClXRHa3ePCaXSdCQHGJ0NRRtxifEHcjZgp/PFnas19nFbu +MVnB36MtqTy32Mbb7IcDtHYEegJ4CcK+4HklH6H35wmrLcLlrc+HMU+59smNJi/rs2O rnvAVEZSDJn0xzyuxAgeVVziswW+EXNhUs6YqVny8nyb2zOd6F5qNSdt537twyO62hNm 5vPg== X-Gm-Message-State: ACrzQf1/dxd4dD6O/9cdwcOlxiIR0+30YRHZRXq7/NoaQS4eyixQ7mhv rVmwCPO12sZFxwc/AF2aTcQ= X-Google-Smtp-Source: AMsMyM6pBq5TwpNtsTVUvHInIZBbYoOuJBkQXuNuwVShQjGOUpgsOSC/9vcBhCvqAYMAPKcdfL6ddw== X-Received: by 2002:a2e:2205:0:b0:26c:2423:a508 with SMTP id i5-20020a2e2205000000b0026c2423a508mr3466604lji.163.1664568289576; Fri, 30 Sep 2022 13:04:49 -0700 (PDT) Original-Received: from smtpclient.apple (c188-150-171-209.bredband.tele2.se. [188.150.171.209]) by smtp.gmail.com with ESMTPSA id b18-20020a056512305200b00498f0434efdsm411751lfb.19.2022.09.30.13.04.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Sep 2022 13:04:48 -0700 (PDT) In-Reply-To: <83czbef6le.fsf@gnu.org> X-Mailer: Apple Mail (2.3654.120.0.1.13) 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:244058 Archived-At: 29 sep. 2022 kl. 19.11 skrev Eli Zaretskii : > Unibyte strings should never be compared with > multibyte, unless they are both pure-ASCII. It's perfectly fine to compare "Madrid" (unibyte) with "M=C3=A1laga" = (non-ASCII multibyte). If you mean that all strings (literals in particular) should be = multibyte by default then I agree and at some point we should take that = step, but it would be quite a breaking change. Perhaps less in practice = than we fear, though... >> So, what can be done? The current string< implementation uses the = character order >>=20 >> ASCII < ub raw 80..FF =3D mb U+0080..U+00FF < U+0100..10FFFF < mb raw = 80..FF >>=20 >> in conflict with string=3D which unifies unibyte and multibyte ASCII = but not raw bytes and Latin-1. >=20 > It would be unimaginable to unify raw bytes with Latin-1. Raw bytes > are not Latin-1 characters, they can stand for any characters, or for > no characters at all. Completely agreed! Let's try to fix that, then. > Unibyte characters don't belong to this order. They > should be converted to multibyte representation to be sensibly > comparable. Oh I agree to some extent but we can't really raise an error if someone = tries so we might as well return something reasonable and coherent. = Besides, there are more good reasons for ordering strings (both = multibyte and unibyte) than might be apparent at first. Working from the assumption that we can't change string=3D to equate raw = bytes in unibyte and multibyte strings, we need to invent an order = between normally incommensurate values which sounds odd but is actually = fine; this is occasionally done and can be quite useful. It's also a matter of performance -- string< has been improved recently = but currently we compare text in Latin and Swahili much faster than = French and Arabic; it would be nice to close that gap. UTF-8 is designed = so that comparing strings by scalar values can be done byte-wise, but = the way we encode raw bytes make them sort right between ASCII and = Latin-1. Given that the specific order doesn't matter much, we could = just run with that.