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

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Matthias(dot)Pitzl(at)izb(dot)de
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Postgresql 8.1: plperl code works with LATIN1, fail
Date: 2007-01-29 15:08:54
Message-ID: 20070129150854.GA88505@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Jan 29, 2007 at 01:34:47PM +0100, Matthias(dot)Pitzl(at)izb(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moran 2007-01-29 15:16:17 Re: Limit on number of users in postgresql?
Previous Message Tom Lane 2007-01-29 15:04:50 Re: Limit on number of users in postgresql?