Edit report at https://bugs.php.net/bug.php?id=80874&edit=1
ID: 80874
Updated by: cmb@php.net
Reported by: tony at tonymarston dot net
Summary: odbc_fetch_array() will not fetch a row containing a
UTF-8 currency code symbol
Status: Open
Type: Bug
Package: ODBC related
Operating System: Windows 10
PHP Version: 7.4.16
Block user comment: N
Private report: N
New Comment:
> A developer at SAP has been investigating this problem and has
> discovered that the PHP odbc module is not formatting the UCS-2
> text correctly on Windows for the HANA ODBC driver.
Ah, I see. The basic problem is that PHP has no notion of the
charset encoding of strings. Thus, it treats all strings as byte
sequences. Therefore, we can't do any automatic conversion to
UCS-2 and use SQLExecDirectW(). Well, actually we could, at least
on Windows, where PHP 7.1.0 introduced UTF-8 support for file
paths, and the respective framework (sapi_windows_cp_get|set).
However, automatically doing the conversion would almost certainly
break existing code for many other ODBC drivers (which do not
automatically convert to UCS-2), so we would need to make that
optional, and an INI setting might not be a good solution. Also,
what to do for non Windows systems is unclear.
Anyhow, this would be more like a new feature, and as such can't
target any of the stable branches (PHP 7.4, PHP 8.0).
Previous Comments:
------------------------------------------------------------------------
[2021-09-06 10:24:44] tony at tonymarston dot net
No, I have not found a workaround for this problem. This means that I cannot use SAP HANA with my
multi-currency ERP application.
------------------------------------------------------------------------
[2021-09-06 09:35:18] jeremy dot galouye at gmail dot com
Hello, I had the same issue have you found a workaround solution ?
Thanks
------------------------------------------------------------------------
[2021-06-05 08:52:53] tony at tonymarston dot net
A developer at SAP has been investigating this problem and has discovered that the PHP odbc module
is not formatting the UCS-2 text correctly on Windows for the HANA ODBC driver. You can read his
full response at https://answers.sap.com/questions/13231775/hana-utf8-characters-being-garbled-when-using-the.html?childToView=13407210
------------------------------------------------------------------------
[2021-04-21 14:38:30] tony at tonymarston dot net
I do not know which driver is fault, so I have also reported this bug to the SAP HANA community at
https://answers.sap.com/questions/13322291/odbc-fetch-array-will-not-fetch-a-row-containing-a.html,
but as they have not tried accessing their database via PHP running on Windows they are unable to
reproduce this fault and there remain clueless.
I do not have the resources to try the same code using PHP on Linux, so I don't know if that
ODBC driver is any better. All I can say at the moment is that trying to access a SAP HANA database
from PHP is not a viable proposition.
------------------------------------------------------------------------
[2021-04-21 12:35:19] cmb@php.net
> These tests clearly show that the HANA ODBC driver mangles UTF8
> values both when written and when read.
If it is the driver, there is not we can do about that, can't we?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=80874
--
Edit this bug report at https://bugs.php.net/bug.php?id=80874&edit=1