#12127 [Com]: Function fgetcsv() lost some letters
| From: | ted at mail dot uk | Date: | Thu, 14 May 2009 18:43:12 +0000 |
| Subject: | #12127 [Com]: Function fgetcsv() lost some letters | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-137330@lists.php.net to get a copy of this message | ||
ID: 12127
Comment by: ted at mail dot uk
Reported By: bitlz at mail dot ru
Status: No Feedback
Bug Type: Filesystem function related
Operating System: Windows 2000 Professional
PHP Version: 4.3.1
New Comment:
Even though they scared the hell out of me. All kidding aside nurses
save lives and I do appreciate them.I bet they were really pretty girls
when they did smile though.
http://usedauto.com.ua/cars/?cid=2
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
http://bugs.php.net/12127
--
Edit this bug report at http://bugs.php.net/?id=12127&edit=1