Edit report at https://bugs.php.net/bug.php?id=12127&edit=1
ID: 12127
Comment by: gtisza at gmail dot com
Reported by: bitlz at mail dot ru
Summary: Function fgetcsv() lost some letters
Status: No Feedback
Type: Bug
Package: Filesystem function related
Operating System: Windows 2000 Professional
PHP Version: 4.3.1
Block user comment: N
Private report: N
New Comment:
Duplicate of bug 45356?
Previous Comments:
------------------------------------------------------------------------
[2008-05-11 10:37:48] pienkowskip at gmail dot com
I found out that locale in shell interpreter is 'pl_PL.UTF-8', but my Apache is
using 'C' locale.
I added to script: setlocale(LC_ALL, 'pl_PL.UTF-8'); and I has no problems with
fgetcsv().
I think it should be fixed, because csv standard doesn't mention about locales
or encodings - csv is rather binary than textual.
------------------------------------------------------------------------
[2008-05-11 10:21:51] pienkowskip at gmail dot com
it's very strange that when I run script by shell interpreter it's works
properly, but when my Apache runs it there is a problem (mentioned above)
------------------------------------------------------------------------
[2008-05-01 15:26:29] steve at goooooogle dot com
confirming on PHP 5.2.0-8
Csv file line:-
1,Alert Status,État de l'alerte
fgetcsv ignores the É
It only happens if É is right after the delimiter ,
Only way I got around this was to save the file as UTF8 as mention in the
earlier comment. Didnt work even with setlocale(LC_ALL,'fr_FR.ISO-8859-1')
------------------------------------------------------------------------
[2007-06-01 12:58:59] laus at tinevej dot dk
I got the same problem in php-5.2.2 with danish special letters (ÆØÅ) when it
is saved in iso-8859-1.
But if i save the csv files as utf-8 the problem disappears.
------------------------------------------------------------------------
[2006-11-24 09:32:47] info at netangels dot ru
Guys
The problem still occurs even in PHP 5.2.0 and PHP 5.1.x as well as in 5.0.x
but we've found a workaround.
If csv-file is in russian encoding (cp1251) then php-script should do:
setlocale(LC_ALL, "ru_RU");
BEFORE call fgetcsv() if current locale is not ru_RU. If locale is ru_RU
already, it works well on all versions of php from 4.3.x up to the latest 5.2.0
without requiring setlocale()
------------------------------------------------------------------------
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=12127
--
Edit this bug report at https://bugs.php.net/bug.php?id=12127&edit=1