public inbox for [email protected]
help / color / mirror / Atom feedFrom: Igor Korot <[email protected]>
To: [email protected]
Subject: Re: PQexecPrepared() question
Date: Mon, 22 Dec 2025 15:07:52 -0800
Message-ID: <CA+FnnTwz2PSSi2MVoH3rCKtAn=beRm97m7nGyxX1d3oF5EFVkw@mail.gmail.com> (raw)
In-Reply-To: <47v26pfhc2hnz3ax2u6ogke7npeyghbkxghov5hysv2f7ttchs@c5vrfavj7oqe>
References: <[email protected]>
<CA+FnnTzE34VJWR7xkymaKEwXiiQ8j3o03m0+qcQsRr2JkRQLwQ@mail.gmail.com>
<[email protected]>
<CA+FnnTz5tcJEL12ir1nxe9q75rxaAdfBtcFUNiD4R5gW_JR23A@mail.gmail.com>
<CA+FnnTyYBNwbzFs5GqO+SMg3g60jPTsnmFwTV=_s_YboGo-68A@mail.gmail.com>
<[email protected]>
<CA+FnnTwtd-YJo5zp3obQer3qfbacg5s-4b3+5PvUkL3e+5Eh4Q@mail.gmail.com>
<[email protected]>
<6uz5ppdgqhlovw3df2dmzgzrfbfmmy5pys37ln7u4kyidaftgo@gxgkvkbwk3zh>
<CA+FnnTxVZ64Lrq3t35j7w8mE=oP94TgetT62+Y8=ea_VfE2uEw@mail.gmail.com>
<47v26pfhc2hnz3ax2u6ogke7npeyghbkxghov5hysv2f7ttchs@c5vrfavj7oqe>
Hi, Peter,
On Mon, Dec 22, 2025 at 1:55 AM Peter J. Holzer <[email protected]> wrote:
>
> On 2025-12-21 17:30:38 -0800, Igor Korot wrote:
> > On Sun, Dec 21, 2025 at 1:19 PM Peter J. Holzer <[email protected]> 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 string
> > > 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 = src.c_str();
> > while( *dest )
> > {
> > dest++;
> > }
> > while( *temp )
> > {
> > *dest = *temp;
> > dest++;
> > temp++;
> > }
> > *dest++ = '\0';
> > *dest = '\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.
> |_|_) | |
> | | | [email protected] | -- Charles Stross, "Creative writing
> __/ | http://www.hjp.at/ | challenge!"
view thread (19+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: PQexecPrepared() question
In-Reply-To: <CA+FnnTwz2PSSi2MVoH3rCKtAn=beRm97m7nGyxX1d3oF5EFVkw@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox