ID:               36797
 Updated by:       [EMAIL PROTECTED]
 Reported By:      mauroi at digbang dot com
 Status:           Assigned
 Bug Type:         PDO related
 Operating System: Win XP SP2
 PHP Version:      5.1.2
 Assigned To:      wez
 New Comment:

Note that I'm not using HTML entities in the field, but rather, actual
Japanese characters. The bug report here appears to convert these chars
to HTML entities.


Previous Comments:
------------------------------------------------------------------------

[2007-06-05 18:44:26] [EMAIL PROTECTED]

Here's some more reproduce code:

<?php
$dbh = new PDO("oci:dbname=asylum;charset=UTF-8", "dev", "dev");
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

// Create table
$dbh->exec('create table my_test_table(my_field varchar2(100))');

// Insert data
$dbh->exec('insert into my_test_table(my_field) values (\'foo\')');
$dbh->exec('insert into my_test_table(my_field) values
(\'&#26085;&#26412;&#35486; \')');

// Get data
foreach ($dbh->query('select my_field from my_test_table') as $row) {
    var_dump($row);
}

$dbh->exec('drop table my_test_table');
?>


ACTUAL OUTPUT:

array(2) {
  ["MY_FIELD"]=>
  string(3) "foo"
  [0]=>
  string(3) "foo"
}
array(2) {
  ["MY_FIELD"]=>
  string(4) "??? "
  [0]=>
  string(4) "??? "
}


EXPECTED OUTPUT:

array(2) {
  ["MY_FIELD"]=>
  string(3) "foo"
  [0]=>
  string(3) "foo"
}
array(2) {
  ["MY_FIELD"]=>
  string(4) "&#26085;&#26412;&#35486; "
  [0]=>
  string(4) "&#26085;&#26412;&#35486; "
}

------------------------------------------------------------------------

[2007-06-05 16:23:00] [EMAIL PROTECTED]

I'm also having the same problem in PHP 5.2.2. I've set
NLS_LANG=AMERICAN_AMERICA.AL32UTF8 and my PDO DSN is
oci:dbname=foo;charset=UTF-8. These don't seem to have any affect. The
characters I send to the DB through PDO_OCI are still getting converted
to ???????. The DB charset is AL32UTF8. I'm using Linux.

When I change the DSN charset to AL32UTF8, then there is no output on
the page, nor are there errors reported in the error log. PHP appears to
crash but gives no response as to why.

------------------------------------------------------------------------

[2006-03-20 15:29:43] mauroi at digbang dot com

I've tried but the same happens.
I've also tried the complete NLS_LANG (AMERICAN_AMERICA.AL32UTF8) with
no success.

Thanks!

------------------------------------------------------------------------

[2006-03-20 15:25:04] [EMAIL PROTECTED]

Try with "AL32UTF8" instead of "UTF-8".

------------------------------------------------------------------------

[2006-03-20 15:22:13] mauroi at digbang dot com

Description:
------------
I'm trying to use a AL32UTF8 database with PDO, but it seems that the
charset is not correctly set (I get funny characters in the output).
I've tried the method described in
(http://www.oracle.com/technology/pub/articles/php_experts/otn_pdo_oracle5.html)
with no success.
I'm using Oracle instant client for Windows.

Reproduce code:
---------------
sql:

create table foo (field varchar(10));

php:

$a = new PDO('oci:dbname=server;charset=UTF-8', 'user', 'password');

$a->beginTransaction();

$b = $a->prepare('insert into foo (field) values (?)');
$b->bindValue(1, 'áéíóú');
$b->execute();

$c = $a->prepare('select * from foo');
$c->execute();
var_dump($c->fetchAll());

$a->rollBack();

Expected result:
----------------
the result with the row with áéíóú correctly displayed



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=36797&edit=1

Reply via email to