Re: Careful PL/Perl Release Not Required - Mailing list pgsql-hackers

From Alex Hunsaker
Subject Re: Careful PL/Perl Release Not Required
Date
Msg-id AANLkTinudXQeMZpqLMxfxZqjRPGPGDkLrwmaQFOxLrn7@mail.gmail.com
Whole thread Raw
In response to Re: Careful PL/Perl Release Not Required  (Alex Hunsaker <badalex@gmail.com>)
Responses Re: Careful PL/Perl Release Not Required  ("David E. Wheeler" <david@kineticode.com>)
List pgsql-hackers
On Fri, Feb 11, 2011 at 10:44, Alex Hunsaker <badalex@gmail.com> wrote:
> On Fri, Feb 11, 2011 at 10:16, David E. Wheeler <david@kineticode.com> wrote:

> That *looks* like it is decoding the input string, which it is, but
> actually that will double utf8 encode your string. It does not seem to
> in this case because we are dealing with all ascii input. The trick
> here is its also telling perl to decode/treat the *output* string as
> utf8.

Urp, this is a bit of a fib. The problem is actual in plperl not perl
persay. Pre 9.1 we always fetched perls internal string *ignoring* the
utf8 flag. So if you had octets that were utf8 things would work. The
utf8::decode($_[0]); uri_unescape($_[0]); happened to make the return
string internally be utf8 and so it would only return 1 char. Thats
what the op wanted and why it seemed to fix his problem. But thats
actually a bug! utf8::decode($_[0]) should not have changed anything
at all on the output side. It should still have returned 2 characters
instead of 1.


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Range Types: << >> -|- ops vs empty range
Next
From: Josh Berkus
Date:
Subject: Re: Range Types: << >> -|- ops vs empty range