utf-8 flag always off in plperl function arguments

From: David Kamholz <davekam(at)pobox(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: utf-8 flag always off in plperl function arguments
Date: 2004-12-03 18:16:55
Message-ID: 83BD9827-4557-11D9-A142-000D932F45FA@pobox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-patches

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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2004-12-03 19:53:33 Re: [Fwd: Bug#283856: postgresql: mistakes in src/backend/po/fr.po]
Previous Message postgresbugs 2004-12-03 18:12:24 Re: Foreign keys referencing parent table fails on insert

Browse pgsql-patches by date

  From Date Subject
Next Message David Fetter 2004-12-03 19:39:31 Re: Docs - Plpgsql trigger example auditing changes into
Previous Message Bruce Momjian 2004-12-03 17:13:26 Re: [HACKERS] multiline CSV fields