utf-8 flag always off in plperl function arguments

Поиск
Список
Период
Сортировка
От David Kamholz
Тема utf-8 flag always off in plperl function arguments
Дата
Msg-id 83BD9827-4557-11D9-A142-000D932F45FA@pobox.com
обсуждение исходный текст
Ответы Re: utf-8 flag always off in plperl function arguments  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Hello:

Since 5.6 or so, perl has stored an internal flag on every string to
mark whether it's UTF-8 or not. For data of unknown encoding, such as
data read from files, the default is latin1, but it can be changed with
use encoding 'utf8'. Now, I have a postgresql database in charset
UNICODE. So, postgres knows the data is UTF-8. However, when passing
arguments to plperl functions, no matter what the charset, postgres
ALWAYS sets the UTF-8 flag to off. This means that the only way to
handle the string properly in perl, when it matters that perl knows
it's UTF-8, is to use utf8::upgrade -- on every argument, in every
function, every time. This is rather kludgy, considering there already
exists a way to fix it by calling the libperl API properly. It would be
nice if it could be fixed in 8 final (it's exactly the same in 8 beta
and 7.4.6).

Regards,
Dave

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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: [Fwd: Bug#283856: postgresql: mistakes in src/backend/po/fr.po]
Следующее
От: Tom Lane
Дата:
Сообщение: Re: utf-8 flag always off in plperl function arguments