php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40371 pg_set_client_encoding() and pg_client_encoding() are inconsistent
Submitted: 2007-02-06 13:15 UTC Modified: 2007-02-19 17:33 UTC
From: jamaicafisk at gmail dot com Assigned: edink (profile)
Status: Closed Package: PostgreSQL related
PHP Version: 6CVS-2007-02-06 (snap) OS: Windows XP SP2
Private report: No CVE-ID: None
 [2007-02-06 13:15 UTC] jamaicafisk at gmail dot com
Description:
------------
pg_set_client_encoding('UTF-8') returns 0 but a call to pg_client_encoding() afterwards returns SQL_ASCII

The same code works on FreeBSD 6.2-RC1 and PHP 5.2.0 built against Postgresql 8.2

Reproduce code:
---------------
<?php
pg_connect('host=localhost dbname=db user=myuser password=mypass');
echo "pg_set_client_encoding: " . pg_set_client_encoding('UTF-8') . "\n";
$res = pg_query('SHOW client_encoding;');
echo "client_encoding: " . pg_fetch_object($res)->client_encoding . "\n";
echo "pg_client_encoding: " . pg_client_encoding();
?>

Expected result:
----------------
pg_set_client_encoding: 0
client_encoding: UTF-8
pg_client_encoding: UTF-8

Actual result:
--------------
pg_set_client_encoding: 0
client_encoding: UTF-8
pg_client_encoding: SQL_ASCII

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-06 13:23 UTC] tony2001@php.net
This means PgSQL client has been built without multibyte support.
Edin, is this possible to change somehow?
 [2007-02-19 17:33 UTC] edink@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 22:01:28 2024 UTC