From: | Sergey Burladyan <eshkinkot(at)gmail(dot)com> |
---|---|
To: | pgadmin-hackers(at)postgresql(dot)org |
Subject: | pgagent unicode support |
Date: | 2021-02-06 04:59:58 |
Message-ID: | 87a6shyenl.fsf@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgadmin-hackers |
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(at)postgres ERROR: unterminated quoted string at or near "'" at character 8
2021-02-05 23:19:05 UTC [15600-2] postgres(at)postgres STATEMENT: select '
====================
Please see attached patch.
I only test it on GNU/Linux and can't test it on Windows, sorry.
--
Sergey Burladyan
Attachment | Content-Type | Size |
---|---|---|
Fix-multibyte-strings-handling.patch | text/x-patch | 1.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Aditya Toshniwal | 2021-02-08 04:23:05 | Re: [pgAdmin] RM6117 Unable to update column level privileges from security tab. |
Previous Message | Rahul Shirsat | 2021-02-05 19:54:39 | [pgAdmin] RM6117 Unable to update column level privileges from security tab. |