Edit report at https://bugs.php.net/bug.php?id=48507&edit=1
ID: 48507 Comment by: php-bug-48507 at bsrealm dot net Reported by: krynble at yahoo dot com dot br Summary: fgetcsv() ignoring special characters Status: Bogus Type: Bug Package: Filesystem function related Operating System: Unix PHP Version: 5.* Block user comment: N Private report: N New Comment: This IS a bug. Whatever locale is, I expect this function to read everything between delimiter characters without stripping the contents. Besides, docs say that files in one-byte encoding would read wrong, and there is a different case. This bug causes serious portability issue. In my case, this function was used to read custom database that was storing descriptions entered by users. Some descriptions were in utf-8 enconding. Function just had to read whatever was between delimiter characters and it worked like that on Windows hosting and stopped working after moving to Unix hosting. Note, file itself is not utf-8 encoded and it should not be. It is not related to locale. It must read data, even if it's binary, between delimiters. Previous Comments: ------------------------------------------------------------------------ [2011-02-26 02:46:32] gjorgjioski at gmail dot com This is short example: kategorija Å¡irina platiÅ¡Ä Å¡tevilo read: kategorija irina platiÅ¡Ä tevilo expected: kategorija Å¡irina platiÅ¡Ä Å¡tevilo ------------------------------------------------------------------------ [2011-02-26 02:36:32] gjorgjioski at gmail dot com This bug occurs also when file is in UTF8 (tab delimited file using Å¡,Ä characters). I can provide an example. ------------------------------------------------------------------------ [2010-05-19 13:39:52] pahan at hubbitus dot spb dot su > Quote from the docs: > Note: Locale setting is taken into account by this function. If LANG is e.g. > en_US.UTF-8, files in one-byte encoding are read wrong by this function. Ok, bug documented as "are read wrong by this function" is better then nothing. But do you plan fix this wrong behaviour? ------------------------------------------------------------------------ [2010-05-18 11:03:42] m...@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Quote from the docs: Note: Locale setting is taken into account by this function. If LANG is e.g. en_US.UTF-8, files in one-byte encoding are read wrong by this function. ------------------------------------------------------------------------ [2009-12-12 11:40:29] pahan at hubbitus dot spb dot su Sorry for duplicate (#50456 is my), but in it, additionally to there described problem in fgetcsv I also suggest fix fputcvs to allow [force] enclosing single words in field. Off course it does *not* solve this problem of incorrect fgetcsv parsing, because RFC allow not quoted values ( http://www.faqs.org/rfcs/rfc4180.html , section 2.5 ), but, it is make pair fputcsv/fgetcsv as minimum compatible in PHP implementation. ------------------------------------------------------------------------ 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=48507 -- Edit this bug report at https://bugs.php.net/bug.php?id=48507&edit=1