Re: Re: [COMMITTERS] pgsql: Force strings passed to and from plperl to be in UTF8 encoding.

Поиск
Список
Период
Сортировка
От Alex Hunsaker
Тема Re: Re: [COMMITTERS] pgsql: Force strings passed to and from plperl to be in UTF8 encoding.
Дата
Msg-id CAFaPBrToG+yseU7vdMZ3uMmGgjeoYYEtec1MUWcN1kkuuCJ5Zw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Re: [COMMITTERS] pgsql: Force strings passed to and from plperl to be in UTF8 encoding.  (Alex Hunsaker <badalex@gmail.com>)
Ответы Re: Re: [COMMITTERS] pgsql: Force strings passed to and from plperl to be in UTF8 encoding.
Список pgsql-hackers
On Wed, Oct 5, 2011 at 00:30, Alex Hunsaker <badalex@gmail.com> wrote:
> On Tue, Oct 4, 2011 at 23:46, Amit Khandekar
> <amit.khandekar@enterprisedb.com> wrote:

>> You mean the final changes in plperl_helpers.h would look like
>> something like this right? :
>>
>>  static inline char *
>>  utf_u2e(const char *utf8_str, size_t len)
>>  {
>>        char       *ret = (char *) pg_do_encoding_conversion((unsigned
>> char *) utf8_str, len, PG_UTF8, GetDatabaseEncoding());
>>
>>        if (ret == utf8_str)
>> +       {
>> +               if (GetDatabaseEncoding() == PG_UTF8 ||
>> +                       GetDatabaseEncoding() == PG_SQL_ASCII)
>> +               {
>> +                       pg_verify_mbstr_len(PG_UTF8, utf8_str, len, false);
>> +               }
>> +
>>                ret = pstrdup(ret);
>> +       }
>>        return ret;
>>  }
>

>> Yeah I am ok with that. It's just an additional check besides (ret ==
>> utf8_str) to know if we really require validation.

Find it attached. [ Note I didn't put the check inside the if (ret ==
utf8_str) as it seemed a bit cleaner (indentation wise) to have it
outside ]

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Greg Smith
Дата:
Сообщение: Re: Displaying accumulated autovacuum cost
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: Separating bgwriter and checkpointer