Re: pgagent unicode support

From: Sergey Burladyan <eshkinkot(at)gmail(dot)com>
To: Neel Patel <neel(dot)patel(at)enterprisedb(dot)com>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>, Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>, Dave Page <dpage(at)pgadmin(dot)org>
Subject: Re: pgagent unicode support
Date: 2021-02-24 11:23:39
Message-ID: 874ki1yais.fsf@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Neel Patel <neel(dot)patel(at)enterprisedb(dot)com> writes:

> Do you have any comments for this updated patch ? Let us know ASAP so that
> we can commit it.

Sorry about the delay.

It looks better than my patch, thanks!

There is only two comments, about wcstombs_s and about setlocale.

About win32 wcstombs_s:
+ wcstombs_s(&charsConverted, mbs, mb_len + 10, wchar_str, mb_len + 1);

https://docs.microsoft.com/ru-ru/cpp/c-runtime-library/reference/wcstombs-s-wcstombs-s-l?view=msvc-160
>> sizeInBytes
>> The size in bytes of the mbstr buffer.
>> count
>> The maximum number of bytes to store in the mbstr buffer, not including
>> the terminating null character

Maybe it should look something like this:
+ wcstombs_s(&charsConverted, mbs, mb_len + 1, wchar_str, mb_len);

About setlocale, I think you missed it in your patch:
diff --git a/unix.cpp b/unix.cpp
index 9a41e38..d4b0d3d 100644
--- a/unix.cpp
+++ b/unix.cpp
@@ -155,6 +155,8 @@ static void daemonize(void)

int main(int argc, char **argv)
{
+ setlocale(LC_ALL, "");
+
std::wstring executable;
executable.assign(CharToWString(argv[0]));

--
Sergey Burladyan

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Sergey Burladyan 2021-02-24 11:42:27 Re: pgagent unicode support
Previous Message Dave Page 2021-02-23 16:12:59 pgAdmin 4 commit: Ensure we can build the node modules on ARM.