Re: BUG #5010: perl iconv function returns ? character

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Lampa <lampacz(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org, Andrew Dunstan <andrew(at)dunslane(dot)net>
Subject: Re: BUG #5010: perl iconv function returns ? character
Date: 2009-09-06 16:38:30
Message-ID: 25035.1252255110@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Tue, Aug 25, 2009 at 8:15 AM, Lampa<lampacz(at)gmail(dot)com> wrote:
>> function my_ascii2 is defined:
>> CREATE FUNCTION my_ascii2(text) RETURNS text AS $$ use strict; use
>> Text::Iconv; my $conv = Text::Iconv->new("UTF8", "ASCII//TRANSLIT"); return
>> $conv->convert($_[0]); $$ LANGUAGE plperlu;
>>
>> 8.3.x version works perfectly, 8.4.0 problem

> I can't reproduce this on 8.4.0 or CVS HEAD. I think that whatever
> problem you have here is not a PostgreSQL bug.

Hmm ... I can reproduce the problem on Fedora 11. Given a UTF8-encoded
database (I don't think locale matters), 8.3.7 works as described, but
8.3.8 fails as described, as do 8.4.1 and HEAD. Given that the only
difference in plperl.c between 8.3.7 and 8.3.8 is the addition of the
PERL_SYS_INIT3 call, I have to suppose that that's screwing up
Text::Iconv somehow.

I'd bet a small amount of money that this is somehow related to the
UTF8-specific code in plperl_safe_init(), which always struck me
as unexplained hocus-pocus. Since the test function is plperlu,
plperl_safe_init() obviously can't be directly to blame; but I'm
thinking that what it's really doing is papering over some missed
initialization issue that affects plperlu functions too.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2009-09-06 16:52:51 Re: BUG #5010: perl iconv function returns ? character
Previous Message Robert Haas 2009-09-06 15:58:26 Re: BUG #5034: plperlu problem with gethostbyname