PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB » Bug #8642

postgres and some characters fails

Details

Submitted2006-09-06 09:07 UTC
Fromruben at rentalia dot com
Assigneddanielc
StatusBogus
PackageDB
PHP Version5_2 CVS-2006-09-06
OSLinux
Roadmaps(Not assigned)

Comments

[2006-09-06 09:07 UTC] ruben at rentalia dot com

Description:
------------
Postgres version 8.1.4
Tried with PHP 5.1.4 and php5.2-200607110830

Postgres has a row that contais, for example,

.. text “pé” text ...

You can try to get that row using Pear DB , and I recieve a "Unkown Error (Pear DB error object)" due “ and ” character.

Catching the error with errorhandler funcion I get the following information

pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR: character 0xe2809c of encoding "UTF8" has no equivalent in "LATIN9"

I think that is a Pear DB problem because with coldfusion (and coldfusion driver) it works.

Thats strange. With postgres 8.1.3 works, postgres 8.1.4 crash.

By other way, coldfusion works with both versions of postgres, and I think is a pear problem.

Test script:
---------------
Just connect to the database and perform a select of that row.
I just configure:

$options = array(
'persistent' => TRUE,
'debug' => 2,
);

$db =& DB::connect(DSN, $options);
if (DB::isError($db)) {
die($db->getMessage());
}

$db->query( "set client_encoding to 'iso8859-15'" );

Expected result:
----------------
I should not have an error. Maybe I should get strange characters, but not an error.

Actual result:
--------------
Error shown above

[2006-09-07 06:30 UTC] ruben at rentalia dot com

If I execute it on "PostgreSQL command line prompt" it works. SQL executes fine, and I get the rows. Working with that results I found the characters where was the problem.

[2006-09-07 06:32 UTC] ruben at rentalia dot com

Anyway, why is trying to convert from UTF-8 to LATIN9?

[2006-09-08 06:14 UTC] ruben at rentalia dot com

I ll check pg_set_client_encoding for details.

I am sorry I cannot try more test on the platform because I had to fix it asap. I installed again postgres 8.1.3

If I have some time I will install everything on any computer and I ll try pg_query() test.