Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vVow4-008bmW-0N for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Dec 2025 10:39:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vVow2-00C9k4-2p for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Dec 2025 10:39:11 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vVow2-00C9jw-0a for pgsql-hackers@lists.postgresql.org; Wed, 17 Dec 2025 10:39:11 +0000 Received: from fhigh-a4-smtp.messagingengine.com ([103.168.172.155]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vVow0-0018AM-3D for pgsql-hackers@postgresql.org; Wed, 17 Dec 2025 10:39:10 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfhigh.phl.internal (Postfix) with ESMTP id 03C7614001D5; Wed, 17 Dec 2025 05:39:08 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Wed, 17 Dec 2025 05:39:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eisentraut.org; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm3; t=1765967948; x=1766054348; bh=iVk4SQ28Pb1M6Op1GW5Nl0BrE2Nmk9xg mBTsYqm1XSY=; b=aqRD+RSkZ6yOq41h12T/WD0ldgY0/MQKqvVfwRs6sIsKiCJ4 D0C4Lzf8HQY6IyykbG6x5sLTAgtxxdXMPbmRpkKrcekJajp8KuNqfZtTgWbFssEH VfNaXKP/2hsBnaNeJckFHHW1CF6SViD7T84ZXOF8+s7k4ByV9kMFFzEgLJ1xfEa0 1kWvojTbOwdh/iFA1IBggJujeglBLpldcXTGdKckqmRT8PV1pbfUc/d6yGXpQpm6 jRKVqtE6FKDJRu7oSwSw2xOF4qW8JEEPchuqe6TN/bGcq18D8Gi+KwJRB8yJwaC8 SKpavXG3JkUcLP+2C9DRhx9Hf7+Edp0saWqFrg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1765967948; x= 1766054348; bh=iVk4SQ28Pb1M6Op1GW5Nl0BrE2Nmk9xgmBTsYqm1XSY=; b=x M8tNyQmPTOo5pDWF3LoO9JQ2GetASu9aUNz4UP1G4Uk7uwPYKOTUw75BfbRhbjkC YhFZt9lJVY4+j4cNCLUNcvt+rLnZHRAmlNuTbPj/P7AcJGRTAsMon5VhSuHhPKB7 pgzr5zApJkfI9PUUN+NWI+EvrBmQCsn/035n0myE0JIvJWfX6gpD38N0pZNLgusa v+SgNZeqkwEPRvE1wGPDOIv2gs6NJaKYK0NqZ6BB6CTt911NUtXRPYsEMt/ryXRq bfpkWQcSFmEDU1vCcAb/s5tyuSXubIJBNovzFAgVw2pw9msngyrxZvE+RuKKeTNj bra5Xbyf3laOSd7nT7VBw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdegvdefgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefkffggfgfuvfevfhfhjggtgfesthekredttddvjeenucfhrhhomheprfgvthgvrhcu gfhishgvnhhtrhgruhhtuceophgvthgvrhesvghishgvnhhtrhgruhhtrdhorhhgqeenuc ggtffrrghtthgvrhhnpeejhfevhedttefgfffhhfeffefggffhffelgfeiueeukeehvdeh vdefheffvdefueenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehpvghtvghrsegvihhsvghnthhrrghuthdrohhrghdpnhgspghrtghpthhtohep hedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepphhgshhqlhesjhdquggrvhhish drtghomhdprhgtphhtthhopehlihdrvghvrghnrdgthhgrohesghhmrghilhdrtghomhdp rhgtphhtthhopehthhhomhgrshdrmhhunhhrohesghhmrghilhdrtghomhdprhgtphhtth hopehtghhlsehsshhsrdhpghhhrdhprgdruhhspdhrtghpthhtohepphhgshhqlhdqhhgr tghkvghrshesphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: ie0a040ee:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 17 Dec 2025 05:39:06 -0500 (EST) Message-ID: Date: Wed, 17 Dec 2025 11:39:05 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Remaining dependency on setlocale() To: Jeff Davis , Chao Li Cc: Thomas Munro , Tom Lane , pgsql-hackers@postgresql.org References: <4c5da86af36a0d5e430eee3f60ce5e06f1b5cd34.camel@j-davis.com> <8186b28a1a39e61a0d833a4c25a8909ebbbabd48.camel@j-davis.com> <450ceb6260cad30d7afdf155d991a9caafee7c0d.camel@j-davis.com> <78edc741a168c54d57cc898a5877b6443527a2c8.camel@j-davis.com> <83F6E6A9-FF29-41C9-9E15-EA5360E912D0@gmail.com> <5f65b85740197ba6249ea507cddf609f84a6188b.camel@j-davis.com> <38f3f4a6-e95e-47a7-914f-110dd6191301@eisentraut.org> <0e186a9a92634f0c5675a618ff5685d00cd8f836.camel@j-davis.com> Content-Language: de-DE, en-US From: Peter Eisentraut In-Reply-To: <0e186a9a92634f0c5675a618ff5685d00cd8f836.camel@j-davis.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 12.12.25 21:11, Jeff Davis wrote: >> case '\xc7':        /* C with cedilla */ >> >> so the premise that "fuzzystrmatch is designed for ASCII" does not >> appear to be correct.  Needs more analysis. >> >> (But apparently it's not multibyte aware at all, so I don't know what >> to >> do about that.) > I didn't notice that, thank you. Agreed, we need a bit more discussion > around this case as well as soundex(). Soundex is an ASCII-only algorithm, there is no expectation that the algorithm does anything useful with non-ASCII characters, and it doesn't do so now. So I think using pg_ascii_toupper() is ok. (Users could for example use unaccent to preprocess text.) One might wonder if the presence of non-ASCII characters should be an error, but that doesn't have to be the subject of this thread. I noticed that the Wikipedia page for Soundex even calls out PostgreSQL for doing things slightly different than everyone else, but I haven't studied the details. For Metaphone, I found the reference implementation linked from its Wikipedia page, and it looks like our implementation is pretty closely aligned to that. That reference implementation also contains the C-with-cedilla case explicitly. The correct fix here would probably be to change the implementation to work on wide characters. But I think for the moment you could try a shortcut like, use pg_ascii_toupper(), but if the encoding is LATIN1 (or LATIN9 or whichever other encodings also contain C-with-cedilla at that code point), then explicitly uppercase that one as well. This would preserve the existing behavior. Note that the documentation calls out: "At present, the soundex, metaphone, dmetaphone, and dmetaphone_alt functions do not work well with multibyte encodings (such as UTF-8)."