Re: [COMMITTERS] pgsql: Force strings passed to and from plperl to be in UTF8 encoding.
Alex Hunsaker <badalex@gmail.com>
From: Alex Hunsaker <badalex@gmail.com>
To: Andrew Dunstan <andrew@dunslane.net>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2011-02-07T02:13:22Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Force strings passed to and from plperl to be in UTF8 encoding.
- 50d89d422f9c 9.1.0 cited
On Sun, Feb 6, 2011 at 18:02, Andrew Dunstan <andrew@dunslane.net> wrote: > > > > > > On 02/06/2011 05:31 PM, Andrew Dunstan wrote: >> >> Force strings passed to and from plperl to be in UTF8 encoding. >> >> String are converted to UTF8 on the way into perl and to the >> database encoding on the way back. This avoids a number of >> observed anomalies, and ensures Perl a consistent view of the >> world. >> >> Some minor code cleanups are also accomplished. >> >> Alex Hunsaker, reviewed by Andy Colson. > > > This has broken the buildfarm :-( Drat. > perl ppport.h reports: > > *** WARNING: Uses HeUTF8, which may not be portable below perl > 5.11.0, even with 'ppport.h' > Experimentation on a CentOS machine suggests we can cure it with this: > > #ifndef HeUTF8 > #define HeUTF8(he) ((HeKLEN(he) == HEf_SVKEY) ? \ > SvUTF8(HeKEY_sv(he)) > : \ > (U32)HeKUTF8(he)) > #endif Yeah, that should work. BTW I would have loved to add some regression tests for some of this (like the example hek2cstr states). Is there any way to do that?