|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2020-01-03 10:34 UTC] 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);
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 13:00:01 2025 UTC | 
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.