[pgpool-general: 1135] Re: pgpool / PHP-PDO / Quoting Issue with latin1

Tatsuo Ishii ishii at postgresql.org
Fri Oct 26 16:48:21 JST 2012


This is a know limitation of pgpool-II.

http://www.pgpool.net/docs/latest/pgpool-en.html#restriction
----------------------------------------------------------------------
Multi-byte Characters (for all modes)

pgpool-II does not translate between different multi-byte
characters. The encoding for the client, backend and System DB must be
the same.
----------------------------------------------------------------------
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese: http://www.sraoss.co.jp

> Hi,
> 
> I have an issue with a setup where PHP with pdo_pgsql is talking to a
> pgpool server when client_encoding is set to latin1 (the database
> encoding is utf-8).
> 
> Here's the sample script:
> 
> <?php
> $db = new PDO("pgsql:dbname=heineken;user=popscan;host=pgpool");
> $db->exec("set names 'latin1'");
> echo $db->quote("Bär's Hütte")."\n";
> ?>
> 
> Store this script in latin1 encoding and then run it.
> 
> When connected to postgres directly, the output is correctly
> 
> 'Bär''s Hütte' (in latin1)
> 
> But when connected to pgpool, the output is incorrectly:
> 
> 'Bär's Hütte'
> 
> This of course is problematic as this opens applications behind pgpool
> to bad SQL injections when high-bit characters are being used.
> 
> I know that the correct solution is to use utf-8 client encoding to
> begin with, but this is an older but still supported version of our
> application that I can't just port to utf-8 - later versions are using
> utf-8 and are not hit by this issue.
> 
> Any idea what I did wrong here?
> 
> Philip
> _______________________________________________
> pgpool-general mailing list
> pgpool-general at pgpool.net
> http://www.pgpool.net/mailman/listinfo/pgpool-general


More information about the pgpool-general mailing list