Bug 616076 - odbc: fields containing non-ascii characters get truncated
odbc: fields containing non-ascii characters get truncated
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: php (Show other bugs)
14
All Linux
low Severity medium
: ---
: ---
Assigned To: Joe Orton
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-07-19 11:38 EDT by Patrick Monnerat
Modified: 2012-08-16 14:33 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-08-16 14:33:20 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch to enlarge buffers enough for UTF-8 and UCS-4 returned field values (760 bytes, patch)
2010-07-19 11:38 EDT, Patrick Monnerat
no flags Details | Diff

  None (edit)
Description Patrick Monnerat 2010-07-19 11:38:39 EDT
Created attachment 432923 [details]
Patch to enlarge buffers enough for UTF-8 and UCS-4 returned field values

Description of problem:
Retrieving character fields containing non-ascii characters (i.e.: multi-byte UTF-8) results in field value truncation.

Version-Release number of selected component (if applicable):
php-5.3.2-2

How reproducible:
Always

Steps to Reproduce:
1. Configure a database using an ODBC connector that supports character code conversion. Set client charset to utf8.
2. In a table of this database, store a field containing a character whose UTF-8 representation is multi-byte (i.e.: e-acute).
3. Read this field in a PHP script using odbc_fetch_array()
  
Actual results:
The read value is truncated.
With the IBM iseriesAccess ODBC connector, garbage is appended to the truncated value because the returned length is wrong upon truncation (this is a probably a connector bug, but PHP ought to deal with truncation more gently... off topic, anyway).

Expected results:
The full field is read.

Additional info:
--- the "displaysize" is no longer the "byte size" nowadays ---
Although ODBC v2 spec does not deal with multi-byte character sets, allowing PHP not to truncate the value returned by the connector seems reasonable on an operating system that has UTF-8 as its default character set.
Comment 1 Remi Collet 2010-07-21 02:55:34 EDT
Is this issue reported upstream ? (bug ref ?)
Comment 2 Patrick Monnerat 2010-07-21 04:44:19 EDT
Not by me, and not recently
http://bugs.php.net/bug.php?id=25972
It should be noted this discussion occurred when ISO-8859 was the default.
I've seen some other discussions about the UTF-8 fields truncation, but all of them have degenerated into trolls :-(

  Some people argue that ODBC v2 is not intended to deal with multibyte. My own opinion is: it is not PHP's role to decide what can be returned from a DB connector.
  In addition, this patch doesn't break anything, it just improves PHP usability.
Comment 3 Patrick Monnerat 2010-07-28 05:18:44 EDT
I just found a more recent upstream bug report:
http://bugs.php.net/bug.php?id=47133
I describes exactly the problem I'm facing with.
Unfortunately, there is neither an attached PHP patch, nor any answer/comment.
The only "help" provided there is a workaround to suppress trailing garbage (the off-topic iSeries connector thing in above description), but no real solution to avoid the truncation.
Comment 4 Bug Zapper 2010-11-03 07:48:58 EDT
This message is a reminder that Fedora 12 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 12.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '12'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 12's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 12 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 5 Patrick Monnerat 2010-11-05 07:18:31 EDT
Reassigning to F14: problem still unfixed.
Comment 6 Fedora End Of Life 2012-08-16 14:33:23 EDT
This message is a notice that Fedora 14 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 14. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained.  At this time, all open bugs with a Fedora 'version'
of '14' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this 
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen 
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we were unable to fix it before Fedora 14 reached end of life. If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora, you are encouraged to click on 
"Clone This Bug" (top right of this page) and open it against that 
version of Fedora.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Note You need to log in before you can comment on or make changes to this bug.