public inbox for [email protected]
help / color / mirror / Atom feedFrom: Neel Patel <[email protected]>
To: Dave Page <[email protected]>
Cc: Sergey Burladyan <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Cc: Ashesh Vashi <[email protected]>
Subject: Re: pgagent unicode support
Date: Mon, 15 Feb 2021 18:15:26 +0530
Message-ID: <CACCA4P0PG8y_u9vDwTTL4AHbXOfP1k7joLY4tjLQ40DNpWgyoA@mail.gmail.com> (raw)
In-Reply-To: <CA+OCxoxsk-VJOJvw95V+pDN0G79T5-F1jAHB-THsPZd10f0KRg@mail.gmail.com>
References: <[email protected]>
<CA+OCxoxsk-VJOJvw95V+pDN0G79T5-F1jAHB-THsPZd10f0KRg@mail.gmail.com>
Thanks Sergey for the patch.
Sure Dave.
There is some compilation warning in linux, I will fix those and test
pgAgent in windows and update the thread.
On Mon, Feb 8, 2021 at 2:55 PM Dave Page <[email protected]> wrote:
> Hi
>
> On Sat, Feb 6, 2021 at 5:00 AM Sergey Burladyan <[email protected]>
> wrote:
>
>> Currently pgagent doesn't handle unicode correctly.
>>
>> CharToWString function corrupt multibyte characters because it processes
>> string one byte at a time:
>> 148 std::string s = std::string(cstr);
>> 149 std::wstring wsTmp(s.begin(), s.end());
>>
>> WStringToChar function does not take into account that there can be
>> _multi_byte character on wcstombs output and create buffer with
>> size = wcslen:
>> 157 int wstr_length = wcslen(wchar_str);
>> 158 char *dst = new char[wstr_length + 10];
>>
>> Also pgagent do not setup locale with setlocale(), without it all
>> wcs/mbs functions cannot handle multibyte strings.
>>
>> For example:
>>
>> === step code ===
>> select 'это проверка кириллицы в теле запроса pgagent'
>> =================
>>
>> === postgres log ===
>> 2021-02-05 23:19:05 UTC [15600-1] postgres@postgres ERROR: unterminated
>> quoted string at or near "'" at character 8
>> 2021-02-05 23:19:05 UTC [15600-2] postgres@postgres STATEMENT: select '
>> ====================
>>
>> Please see attached patch.
>> I only test it on GNU/Linux and can't test it on Windows, sorry.
>>
>
> Thanks for the patch! Neel/Ashesh; can you take a look please? It looks OK
> to me, but then I'm not overly familiar with multibyte string handling.
> What, if anything, needs to be done on Windows?
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EDB: http://www.enterprisedb.com
>
>
view thread (13+ 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], [email protected], [email protected]
Subject: Re: pgagent unicode support
In-Reply-To: <CACCA4P0PG8y_u9vDwTTL4AHbXOfP1k7joLY4tjLQ40DNpWgyoA@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