note 45607 added to function.pg-set-client-encoding
| From: | jmarcelo at gmx dot de | Date: | Sun, 12 Sep 2004 20:21:17 +0000 |
| Subject: | note 45607 added to function.pg-set-client-encoding | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-76553@lists.php.net to get a copy of this message | ||
If you have experienced some problems with the encode type doing selects, inserts and updates and
are getting back an error message like this: "invalid byte sequence for encoding
'UNICODE'".
Try to use 'pg_set_client_encoding' before 'pg_query'.
$name = "João Marcelo";
$last_name = "Bodè";
$user_id = "1234"; //whatever value
// changes the client encode type to use a portuguese friend encode type
pg_set_client_encoding("LATIN1");
$sql = "insert into user(name, last_name) where id_usuario = '$user_id'";
$res = pg_query($conn, $sql) or die(pg_last_error());
You can also do the same with selects and updates.
----
Manual Page -- http://www.php.net/manual/en/function.pg-set-client-encoding.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+45607
Delete -- http://master.php.net/manage/user-notes.php?action=delete+45607&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+45607&report=yes
Search -- http://master.php.net/manage/user-notes.php