Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 29, 2007 at 01:34:47PM +0100, Matthias.Pitzl@xxxxxx 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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux