Bug #79059 [Opn->Fbk]: PDO ODBC removes strings with encoded chars from results retrieved from IBM i

From: Date: Thu, 01 Oct 2020 10:15:01 +0000
Subject: Bug #79059 [Opn->Fbk]: PDO ODBC removes strings with encoded chars from results retrieved from IBM i
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-229299@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79059&edit=1 ID: 79059 Updated by: cmb@php.net Reported by: mdalco at gmail dot com Summary: PDO ODBC removes strings with encoded chars from results retrieved from IBM i -Status: Open +Status: Feedback Type: Bug Package: PDO ODBC Operating System: Linux Centos 7 PHP Version: 7.3.13 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Well, that is obviously a character encoding issue, but the details are totally unclear to me. Maybe a first step is to check what PDO_ODBC actually delivers, i.e. by changing print_r($row); to var_dump(bin2hex($row['CLDRSO'])); If the non ASCII are actually omitted, that should report a string length of 58 for "S.A.DES EAUX MINÉRALES D'EVIA". Anyway, please report the actual output. Also check whether the driver configuration allows to set a default character encoding. Previous Comments: ------------------------------------------------------------------------ [2020-01-03 10:34:30] mdalco at gmail dot com Description: ------------ If I update the IBM iAccess driver to the last version (iaccess 1.1.0.12) on my server, I can no longer retrieve text data that include encoded chars (e.g. àèìòù and other). The query just runs and retrieves the row, but the fields containing a non ASCII char are empty. If I try to execute the same query with the isql unixODBC utility everything works fine: SQL> SELECT CLCCLI, CLDRSO FROM $$LIBFA0.CLIEN01L WHERE CLCCLI=31 +---------+-------------------------------+ | CLCCLI | CLDRSO | +---------+-------------------------------+ | 31 | S.A.DES EAUX MINÉRALES D'EVIA| +---------+-------------------------------+ SQLRowCount returns -1 1 rows fetched From PHP: $connection = new PDO('odbc:AS400', $user, $password); $result = $connection->query('SELECT CLCCLI, CLDRSO FROM $$LIBFA0.CLIEN01L WHERE CLCCLI=31'); while($row = $result->fetch(PDO::FETCH_ASSOC)) print_r($row); Output: Array ( [CLCCLI] => 31 [CLDRSO] => ) If I switch back to an older version of i access driver (iSeriesAccess 6.1.0) everything works fine, and the same previous script outputs: Array ( [CLCCLI] => 31 [CLDRSO] => S.A.DES EAUX MINÉRALES D'EVIA ) isql works fine with both drivers. Test script: --------------- $connection = new PDO('odbc:AS400', $user, $password); $result = $connection->query('SELECT CLCCLI, CLDRSO FROM $$LIBFA0.CLIEN01L WHERE CLCCLI=31'); while($row = $result->fetch(PDO::FETCH_ASSOC)) print_r($row); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79059&edit=1

« previous php.bugs (#229299) next »