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 1vE7qM-005q3k-7Z for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Oct 2025 15:12:09 +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 1vE7qK-001iWi-U7 for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Oct 2025 15:12:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vE7qK-001iWI-FO for pgsql-hackers@lists.postgresql.org; Wed, 29 Oct 2025 15:12:07 +0000 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vE7qG-004u6H-2c for pgsql-hackers@postgresql.org; Wed, 29 Oct 2025 15:12:07 +0000 Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-b6ce696c18bso6764696a12.1 for ; Wed, 29 Oct 2025 08:12:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1761750722; x=1762355522; 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=gBEjTq4kE4vBK7lhz7E1xdp5KLQUwxZvdvNgTj/WT9o=; b=ZeSIwQ890WNokRL1Pkj/KkNlSFwH2wvwgkBNhFsaX8mch1aMZmgDsX/cXgBVbkQYBN lb4vnIA/wI7MYb8WGShzK8p3/KmYh2zdytPyNNh4O7TzB7f1rj/1uVzxkPE2fd4ECXMD 7MhS5roqumLCPuUeVpnfvGOeowsLXhlLj2Cu8wRE8ggtUKZXjs+UqAHFJe9anszLVLGB CdohBIo0wcysysgZ4JaMn9AY0xut8Y9arLS/kiN7jnE7FEDh/ohH3aHLCRNg9LKmr/77 ulT3vr9DQJ3tDKPahkf5UQCs6x3cYjkBunJy07w1/UoyPN8VvkWq+UnkQPOnuc9oPfnr vrzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761750722; x=1762355522; 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=gBEjTq4kE4vBK7lhz7E1xdp5KLQUwxZvdvNgTj/WT9o=; b=PsWMmF4ZySVqsfosa8o8I/8xBa4OPl64rsZGqQM1xQGGCa3PbnBxcQB/SaFgpaQW6V yeeuugJHQ3tz+ECcwXqnWRTTUHUIh/KRZAXk0I9EQang6GaZU1YwG4Ud8vHxRQMpI42I Uk4nOHwFAVdTyBGzOFsrufQQ13OgkFuUDGSJUVAnCx4T5NHsDPUDjl0/23zcyWi31sLH TWu5xToU8MKgobUgCfIA7JGHNdGDt9hKeLHn+QQl1M8435b3/HQY5EvKFzziM8nxyCG0 ho/7wUB9dSMG2+0Zwxej0c4rsJKgJ9k4IKp/1Zy9OGDSQoHgVlPwmDm8Cj4pvhjccnWb hMZQ== X-Forwarded-Encrypted: i=1; AJvYcCXljAYIf1FCPx995giMtIieK0EfKx/tYlFYCcVn6z8FZ4XO3AmHcm/i5lPnhErNaPaidmGlMSEknONNAgT+@postgresql.org X-Gm-Message-State: AOJu0Yw4myb3P1VKKPOldV1xvfacgtcavjLGbXds1dz/RWSlDo21X7kl DtOkXfxUqWHEwKl6yfutWap6r4AU7nBxx22TubB0zXWOLwNlZF65gobx/ng3qKf/+w== X-Gm-Gg: ASbGncszo+4x7l2ejtZARbDIrdY0ikzAOYlFFn9fNeyedlXv4ByU/yIm838TzAtGOK5 szVF/UomnwpZ+bmV0a1J0JJFpLHMvIL/NqRCevRBuLPGmh/4lkZFpaZuC1s+AY7x8JX+iz/JWy5 L8zWpNxF8Tm8sppSSOFzpqWKsNRvppCus8+IIIAvyolgMhfP+h5JwckLYHVawk+M32TWeOXJgvN GEq5/uqx0OTmGK4sEKt3mg75DosBVGRgfFZiaFvpu2O+gttMEC9TfR0zbjs+ymTJF++lCaccd6z FCFzd9UyIkd1Hqqxizwvpgm2GEDposCff/5PA1F/s9Yw4SRmJXK53FNn/k82hmMcwUtS//oQNzZ PnRxHn/FkoeZRG8R4kAOszgWocZ9YDHOdxSOoYDWbNfojoOqXxo/D2XPr5vWFqDWXUmeILvx2Su 0gVeDtFTzqwvi2ZjnHQ9GGCaf+NqlPzwZf/QpkcN2Kiy8= X-Google-Smtp-Source: AGHT+IExFJK46L0F9Pwzjs2MTX/h1wHUOTx60Q+8WOG50r+WVZALsN5YZGC9KILLuWJLDvPJJPUzwQ== X-Received: by 2002:a17:902:dac1:b0:294:ccc6:cd07 with SMTP id d9443c01a7336-294dedd524bmr40092375ad.1.1761750722083; Wed, 29 Oct 2025 08:12:02 -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-29498d0c6eesm155044345ad.42.2025.10.29.08.12.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Oct 2025 08:12:01 -0700 (PDT) Message-ID: <024a6d53f246c87ee2796563f930a66fde1c0c0d.camel@j-davis.com> 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 08:12:01 -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 Wed, 2025-10-29 at 14:00 +1300, Thomas Munro wrote: > I wonder if the logic to select the member/semantics could be turned > into an enum in the encoding table, to make it even clearer, and then > that could be used as an index into a table of ctype methods obejcts > in _libc.c. As long as we're able to isolate that logic in the libc provider, that's reasonable. The other providers don't need that complexity, they just need to decode straight to UTF-32. > You showed char16_t for Windows, but we don't ever get char16_t out > of > wchar.c, it's always char32_t for UTF-8 input.=C2=A0 It's just that > _libc.c > truncates to UTF-16 or short-circuits to avoid overflow on that > platform (and in the past AIX 32-bit and maybe more), so it wouldn't > belong in a hypothetical union or enum. Oh, I see. > >=20 > Perhaps we could at least put the conversion in a new encoding table > function pointer "pg_wchar_custom_to_wchar_t", so we could reserve a > place to put that sort of optimisation in That sounds like a good step forward. And maybe one to convert to UTF- 32 for ICU, also? > If we do develop this idea though, one issue to contemplate is that > EUC code points might generate more than one wchar_t, looking at > EUC_JIS_2004[1]. Wow, that's unfortunate. Regards, Jeff Davis