note 71423 added to function.pg-set-client-encoding
| From: | php-general at lists dot php dot net | Date: | Tue, 28 Nov 2006 12:52:47 +0000 |
| Subject: | note 71423 added to function.pg-set-client-encoding | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120123@lists.php.net to get a copy of this message | ||
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".
----
Server IP: 83.138.144.80
Probable Submitter: 82.70.214.33
----
Manual Page -- http://www.php.net/manual/en/function.pg-set-client-encoding.php
Edit -- https://master.php.net/note/edit/71423
Del: integrated -- https://master.php.net/note/delete/71423/integrated
Del: useless -- https://master.php.net/note/delete/71423/useless
Del: bad code -- https://master.php.net/note/delete/71423/bad+code
Del: spam -- https://master.php.net/note/delete/71423/spam
Del: non-english -- https://master.php.net/note/delete/71423/non-english
Del: in docs -- https://master.php.net/note/delete/71423/in+docs
Del: other reasons-- https://master.php.net/note/delete/71423
Reject -- https://master.php.net/note/reject/71423
Search -- https://master.php.net/manage/user-notes.php