]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix plperl to handle non-ASCII error message texts correctly.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 29 Sep 2015 14:52:22 +0000 (10:52 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 29 Sep 2015 14:52:22 +0000 (10:52 -0400)
commita16b9b19389d1832286f4d8f259dab0d5be88856
tree12a8bfae542c0887de362f9ea416b9001ad969be
parent9a6fbc2ac709aa8152e6d5d44a107d2d7c67b6f4
Fix plperl to handle non-ASCII error message texts correctly.

We were passing error message texts to croak() verbatim, which turns out
not to work if the text contains non-ASCII characters; Perl mangles their
encoding, as reported in bug #13638 from Michal Leinweber.  To fix, convert
the text into a UTF8-encoded SV first.

It's hard to test this without risking failures in different database
encodings; but we can follow the lead of plpython, which is already
assuming that no-break space (U+00A0) has an equivalent in all encodings
we care about running the regression tests in (cf commit 2dfa15de5).

Back-patch to 9.1.  The code is quite different in 9.0, and anyway it seems
too risky to put something like this into 9.0's final minor release.

Alex Hunsaker, with suggestions from Tim Bunce and Tom Lane
src/pl/plperl/SPI.xs
src/pl/plperl/Util.xs
src/pl/plperl/expected/plperl_elog.out
src/pl/plperl/expected/plperl_elog_1.out
src/pl/plperl/plperl.c
src/pl/plperl/plperl_helpers.h
src/pl/plperl/sql/plperl_elog.sql