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 1vXp0a-006kZE-2F for pgsql-general@arkaria.postgresql.org; Mon, 22 Dec 2025 23:08:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vXp0Y-00GZof-1w for pgsql-general@arkaria.postgresql.org; Mon, 22 Dec 2025 23:08: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.96) (envelope-from ) id 1vXp0Y-00GZoX-0p for pgsql-general@lists.postgresql.org; Mon, 22 Dec 2025 23:08:07 +0000 Received: from mail-yw1-x1133.google.com ([2607:f8b0:4864:20::1133]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vXp0W-002C1k-1D for pgsql-general@lists.postgresql.org; Mon, 22 Dec 2025 23:08:06 +0000 Received: by mail-yw1-x1133.google.com with SMTP id 00721157ae682-78fd0cd23faso15390327b3.2 for ; Mon, 22 Dec 2025 15:08:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766444882; x=1767049682; darn=lists.postgresql.org; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=RTOvuJSYeyvSUpT/QrUkFrZEnxBNkUKRh+EQ3bbh0wg=; b=HY3fb4AsYmG022mReWPMDOs0sQIR2dg/VRqljGBlGfAZfcT4mQmY5Bod9F0hUV7xJL XGmGQFfAn6OfbZHiIJ9M2S3piGJ9f0iL5zGBlE9qeHUhpBe5JoVade0fauMEM+WRX9xY bDWbTYjlme2/QoKH4CBmMg3kgf5hKCDgeRTzv5ue35rE0JRCnYzH3hoUtpGY3O1Xpia0 mxCsXTjBGpLcAawe/IRqmfKoZfPBKejefeYoC7GLuIAzVQButds1HeT4YlUQgkJp7so5 NFhMWETUzUwAjafaA6281UDy82BxWp8CvLu6GCmfk2+MUur/tJGOVs6snGw2Qh8ERroH AsQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766444882; x=1767049682; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=RTOvuJSYeyvSUpT/QrUkFrZEnxBNkUKRh+EQ3bbh0wg=; b=E17AA8N5ZZWivZtCzVuEAiTF7B8OR3ujdAtqMHkfrgW16+bu4r6YDRUklOAepFHXRj EQYWl6s/j4YKCBWffWB7TvUP5jZ+blUwWO+OrUA5+wXSLF9cidNkap6UB8fSjnzJWGV7 zHcn3V9dqp43HbmzNllPe0Jf5JpH16P4NIjG4EnlWjYYvRIudhtRUVwxzvYQ0yrSgXzk rZ8CsOUukPP/ZoLtD1ZeQFprP2Wacr2HgXa7qM01i84Cq6yuG1WngdXKquSDRlTrUjNx Ey4DU3jibGD8KlB3fFWv5E/eWYSh0Mb4FXC3n2GCR+InB2fsPOQ4BYzw1GHZYHnNjf6N keuA== X-Gm-Message-State: AOJu0YwqpFwFbl+A5G/o02HI+ttsON+1MNrs57xmqgSsMAlgWs8FoKzZ iVtbVvxkMtx/VeXYJZcNsYJ9jBCcnK4pe+1/16okl9j2uD8oTCEyrgBmfoub2gCI1b+qu5eJgAf qh71fIBeUPKctXrej0vWZAM7XTayLuJXzQiK/ X-Gm-Gg: AY/fxX5S/Y7lDN3p5JTXVb4doHsfewlJN/ZBhsxrcyySYbswgWYz/4B7dO7Zsegwc2E NUdlWhJhv9gYlv5Z/sdWzO6dlUt5olGpE4D+c2wC08+JguaO/V0q1ACvUbQIiDU8UZiTIQDo+up vc9yVAX0cvCa5dGvOgrfT22FJOVkhEvfaNc4n8xEiuvalv+n6KWDullMeaI4+g1rwXr/aeV/eoZ BQJ81tmAhtc8xPQeRfKC2AvuHYoYpQcxsYf5LKZ/Iiikj7xDUpgpkzAAPRTUFV/OIOuwfgG7NPe 3wpGR0H6Y29voi6LXLbg0SS8Hf8= X-Google-Smtp-Source: AGHT+IHW/XZFRKkP+EKGk9pahf/WcPENjJbk8gkVBd88lRiUfwmQifObAzwZ4IlrVdB/+RDf/MK7f7XihR3vDtYXqvQ= X-Received: by 2002:a05:690c:7347:b0:78f:a7e5:cf59 with SMTP id 00721157ae682-78fb40b511amr95112227b3.69.1766444882133; Mon, 22 Dec 2025 15:08:02 -0800 (PST) MIME-Version: 1.0 References: <9a0ce31a49f149d8d982d2b359095560655f781e.camel@cybertec.at> <852dee881b6cc82b9d4b51d69d48c415e2a87b4d.camel@cybertec.at> <61121.1766295563@sss.pgh.pa.us> <6uz5ppdgqhlovw3df2dmzgzrfbfmmy5pys37ln7u4kyidaftgo@gxgkvkbwk3zh> <47v26pfhc2hnz3ax2u6ogke7npeyghbkxghov5hysv2f7ttchs@c5vrfavj7oqe> In-Reply-To: <47v26pfhc2hnz3ax2u6ogke7npeyghbkxghov5hysv2f7ttchs@c5vrfavj7oqe> From: Igor Korot Date: Mon, 22 Dec 2025 15:07:52 -0800 X-Gm-Features: AQt7F2rYUTT9vbgVgCB9i4VoFCa1sfNDHEZiNczIZABahVqL1JrYgZc3CYrwqMk Message-ID: Subject: Re: PQexecPrepared() question To: pgsql-general@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, Peter, On Mon, Dec 22, 2025 at 1:55=E2=80=AFAM Peter J. Holzer = wrote: > > On 2025-12-21 17:30:38 -0800, Igor Korot wrote: > > On Sun, Dec 21, 2025 at 1:19=E2=80=AFPM Peter J. Holzer wrote: > > > As I see it, Igor has two options: > > > > > > 1) Send UTF8. wcstombs is the wrong tool for this, since it uses the > > > current locale which is obviously not using UTF-8. I don't program= in > > > C++, but I'm pretty sure there is a portable way to encode a strin= g > > > in UTF-8. > [...] > > > I think 1) is the better strategy, but them I've been a UTF-8 fan-boy > > > for over 30 years ;-). > > > > Maybe all I need is something like this: > > > > convert(char *dest, const std::wstring src) > > { > > const wchar_t *temp =3D src.c_str(); > > while( *dest ) > > { > > dest++; > > } > > while( *temp ) > > { > > *dest =3D *temp; > > dest++; > > temp++; > > } > > *dest++ =3D '\0'; > > *dest =3D '\0'; > > } > > > > ? > > I hope your compiler complains loudly about that code. You can't just > assign a wchar_t to a char and expect it to do anything sensible. At least MSVC 2017 did not. However, trying didn't solve it. Same error. > > A short search points to std::wstring_convert, but that has been > deprecated in C++17, and it's not obvious to me what the replacement is. > > There is always ICU, of course, but that feels like cracking a nut with > a sledgehammer. I think ICU IS a replacement for wstring_comvert. Will check it. > > Personally, I might roll my own if an hour of googling doesn't turn up > anything promising (UTF-8 encoding is quite simple), but that shouldn't > be necessary. > > > hjp > > -- > _ | Peter J. Holzer | Story must make more sense than reality. > |_|_) | | > | | | hjp@hjp.at | -- Charles Stross, "Creative writing > __/ | http://www.hjp.at/ | challenge!"