note 71423 deleted from function.pg-set-client-encoding by betz
| From: | betz@php.net | Date: | Tue, 28 Nov 2006 13:07:03 +0000 |
| Subject: | note 71423 deleted from function.pg-set-client-encoding by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-120124@lists.php.net to get a copy of this message | ||
Note Submitter:
----
I cannot get my version of PHP (4.4.4) to change character encoding on a Postgres 8.1 database. My
code is as follows:
<?php
echo (pg_set_client_encoding ($dcHandle, 'UNICODE').'<br />');
echo (pg_client_encoding ().'<br />');
?>
This results in the following output:
0
SQL_ASCII
I can't figure out why this is happening. Can you specify the encoding type to use in the
pg_connect string? Is there some privilage that needs to be set? PHPPgAdmin running on the same
machine connecting to the same server allows me to submit non-ascii characters such as the GBP sign
to the database but I can't figure out its source code and don't know how it does it. My
application causes an error if you try to submit a non-ASCII character:
Warning: pg_query() [function.pg-query]: Query failed: ERROR: invalid byte sequence for encoding
"UTF8": 0xa3 HINT: This error can also happen if the byte sequence does not match the
encoding expected by the server, which is controlled by "client_encoding".