Re: Postgresql 8.1: plperl code works with LATIN1, fail

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: Postgresql 8.1: plperl code works with LATIN1, fail
Дата
Msg-id 20070129150854.GA88505@winnie.fuhr.org
обсуждение исходный текст
Ответ на Re: Postgresql 8.1: plperl code works with LATIN1, fail  (Matthias.Pitzl@izb.de)
Ответы Re: Postgresql 8.1: plperl code works with LATIN1, fail  (merlyn@stonehenge.com (Randal L. Schwartz))
Список pgsql-general
On Mon, Jan 29, 2007 at 01:34:47PM +0100, Matthias.Pitzl@izb.de wrote:
> > If you can't upgrade to 8.2 then you might be able to work around
> > the problem by creating the function as plperlu and adding 'use utf8;'.
>
> As fas as i know 'use utf8;' normally just tells Perl that the source code
> is written in UTF-8 and noting more.

The string literals in the PL/Perl function body are UTF-8 but Perl
isn't treating them as such.  Isn't "use utf8" or "use encoding 'utf8'"
the way to tell Perl to do so?  The perluniintro manual page says this:

  Only one case remains where an explicit "use utf8" is needed: if
  your Perl script itself is encoded in UTF-8, you can use UTF-8
  in your identifier names, and in string and regular expression
  literals, by saying "use utf8".

Isn't that the situation here?  The PL/Perl function body is a
string encoded in the database's encoding, which in this case is
UTF-8.

> For converting from and to UTF-8 in data usually the Encode modul is used.
> Or is this different for plperlu?

Isn't the Encode module used for doing explicit conversions?  I think
the goal is not to have to do so, i.e., to have PL/Perl treat string
literals as UTF-8 if the database encoding is UTF-8.  PostgreSQL 8.2
does so but earlier versions don't.

--
Michael Fuhr

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Limit on number of users in postgresql?
Следующее
От: Bill Moran
Дата:
Сообщение: Re: Limit on number of users in postgresql?