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.94.2) (envelope-from ) id 1vECYu-007EuA-RP for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Oct 2025 20:14:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1vECYt-003buh-Ok for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Oct 2025 20:14:26 +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.94.2) (envelope-from ) id 1vECYt-003buT-Ao for pgsql-hackers@lists.postgresql.org; Wed, 29 Oct 2025 20:14:26 +0000 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vECYq-004RT0-0L for pgsql-hackers@postgresql.org; Wed, 29 Oct 2025 20:14:25 +0000 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-7a4176547bfso323620b3a.2 for ; Wed, 29 Oct 2025 13:14:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1761768862; x=1762373662; darn=postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=1recGg6/XK9SPvx6HnKBjL6sS5fpS2c4lc+HMnf/kLc=; b=Tl1Y5oynRFkm0U7MlMKHF5s8C3PQgJTrsIfACIaKisCaYsqu9p3oweFMBiVMC5rLsw c8ac3SQucq14gpABlhBVnxUat2ARK4OaMSGOYqmY4DINa6/hTuZlC6u2Xpx1w7yS9pI8 whWFtnAG/FwP/XE9JSABZ7iaHROM2HIol5qetUvEYPijdk+VQ00ZyVwDNtAP5h9cAkJK YxGyAT5McJxLdC366a35EXNlpAYCf9R6mw4kFMGjhJQX8axbkmAGOq+83xdBOmDyZOOs UMtX3yXq3Yt73Anun0nmON/eClKVxIjGjqXSA7dF9KBK+1UcS3KFzZc4rr1iAR9XwQz2 iHbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761768862; x=1762373662; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=1recGg6/XK9SPvx6HnKBjL6sS5fpS2c4lc+HMnf/kLc=; b=vsbTGPg/BCDQYE7kXgxoD+WjNTU+auNex9lfHJHhQsAdpQt/17A1euSa65rUtLspDN orTSuCtunwQxpQVJUNDmDR30EmbeUyZvyiTvt6sVDDseeC8LYMLuTRDp9e51i+TmLURz O6/+J3+rwynHy9lTfmkY3B9OfJYoPpmk5Lo5AcZNIl6nK5TtvfY5hqrAiuqjIzDBdS0R vl36my18HuQNll4Uv9J6j1D85LvluCmOKW82ZBSNbxlWs6iy1m8eEL+ZxJHLAV3lM23c wM76Kw81mX1zV+XdGUMXdMH7HZp5LjvR/sLjkXLI1TmoNhFBnlvpcNX6TgyuumChF9mx pc2Q== X-Forwarded-Encrypted: i=1; AJvYcCUJPtp8fLVF4Hij5eS5SYZiAxSD0EhK6on+WVpLfWIalwG9Shh233xajHkvnFvFKnqNNHq4sQo+uqG7beMg@postgresql.org X-Gm-Message-State: AOJu0YwQcCdeIOU5FL+sElLAtu7JRTSXoIwZIxhGkx6TJtg3S5pGY47o KfGm5zaYnms6QYuZKp2LXLQWHCHD4Fy5O4xf+St6N0TVQbIy+Eld2GTA54NyWkuf8g== X-Gm-Gg: ASbGnctp9ew+a3XAH9e3EF7Rvj6Rkh/JHjKwBTPR595Q5CoEV9rN9PoJa8gD/0+64wC D51zHc1eGiAXmXb3jIxAcBKlmouba3IrsuWqzIK2L1Bo8Mq2Bxhd0xhFcbcaAGCmpySr8c9+JCS 8rarb+rhMDfYb95elIEHBFXSoZWMT8nowGHrpjCKpwqlWFnwNfLNppIbymwn9q2a+Qajn8+6szt ZG8WqgH8UIx7h0OM9tH+r1pkhHcJH0JgrEec40Q631XUipzy9ONKnltiomvWzEq2+QjjInHjx73 9x+26llj9C1ALtAEOfaWBVUvrAccxbeFsVhKIsUrirWxdDP2P0wCP8oKGcU1qaajS9FmT5PqqHn BpXX14wb7bCgpw7fYuBvWBUsVQEWixDibzalo2MnSE0La/l7gWgCAM/xwHXf9rnlTutDqHnLPHM pAZySJF1Pjozx5avjWESbGjYRP0A63JWez X-Google-Smtp-Source: AGHT+IGWT4hZ9smX/GNpbO0XiRfcjWOt2LVvy6bRH7n5YCz3hf79fAyj3/iGkHe+32e8KHP082JsEg== X-Received: by 2002:a17:902:c942:b0:290:af0e:1183 with SMTP id d9443c01a7336-294deefebe8mr47542705ad.51.1761768862214; Wed, 29 Oct 2025 13:14:22 -0700 (PDT) Received: from jeff-ws-bridge.lan (c-24-7-19-3.hsd1.ca.comcast.net. [24.7.19.3]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-29498d22ea8sm161260905ad.45.2025.10.29.13.14.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Oct 2025 13:14:21 -0700 (PDT) Message-ID: Subject: Re: C11: should we use char32_t for unicode code points? From: Jeff Davis To: Thomas Munro Cc: Tatsuo Ishii , pgsql-hackers@postgresql.org Date: Wed, 29 Oct 2025 13:14:21 -0700 In-Reply-To: References: <20251024.184315.1449345234035166124.ishii@postgresql.org> <435cf6bcf14bb91235da065c70d782863ca9b80e.camel@j-davis.com> <8e5e4892c5c6b1b031b8e715dd254f21d9fb2bd9.camel@j-davis.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.3-0ubuntu1 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2025-10-30 at 04:25 +1300, Thomas Munro wrote: > Here are some sketch-quality patches to try out some of these ideas, > for discussion.=C2=A0 I gave them .txt endings so as not to hijack your > thread's CI. I like the direction this is going. I will commit the char32_t work anyway, so afterward feel free to hijack the thread (there's a lot of good information here so continuing here might be more productive than starting a new thread). Regarding 0002, IIUC, for PG_WCHAR_UTF32, surrogates are forbidden, but the comment about UTF-16 is a bit vague. I think we should add some asserts to make it clear. The basic communication mechanism between the modules is the database encoding: it determines PgWcharEncodingScheme in both wchar.c and pg_locale_libc.c. That seems reasonable to me, and doesn't interfere with the other providers. I'm still not quite sure how this fits with ICU in a single-byte encoding, but doesn't seem worse than what we do currently. Also, tangentially, I'm a bit anxious to do a permanent setlocale(LC_CTYPE, "C"), and we are very close. If these two threads are successful, I believe we can do it: https://www.postgresql.org/message-id/90f176c5b85b9da26a3265b2630ece3552068= 566.camel%40j-davis.com https://www.postgresql.org/message-id/d9657a6e51aa20702447bb2386b32fea62186= 70f.camel@j-davis.com That would be a big simplification because it would isolate libc ctype behavior to pg_locale_libc.c. That would make me feel generally more comfortable with additional work in this area. Regards, Jeff Davis