Edit report at https://bugs.php.net/bug.php?id=48507&edit=1
ID: 48507
Comment by: figura at hotbox dot ru
Reported by: krynble at yahoo dot com dot br
Summary: fgetcsv() ignoring special characters
Status: Not a bug
Type: Bug
Package: Filesystem function related
Operating System: Unix
PHP Version: 5.*
Block user comment: N
Private report: N
New Comment:
setlocale() might solve the issue but I do not see any reason to set up
dependence of this fgetcsv on locale settings. The format is straight and
clear.
Especially this "feature" confuses when the string is read in UTF-8 format.
Previous Comments:
------------------------------------------------------------------------
[2012-01-26 19:55:01] eswald at middil dot com
Tested with LANG=C, input file encoding of UTF-8.
Also tested with LANG=C, input file encoding of cp1252, with identical results,
except that the output characters (what was left of them) were also cp1252.
------------------------------------------------------------------------
[2012-01-26 19:50:26] eswald at middil dot com
Confirmed with php5 (5.3.6-13ubuntu3.2 on Oneiric Ocelot); can be worked around
by quoting the value with quotation marks. For example, the line
a,"a",é,"é",óú,"óú",ó&ú,"ó&ú"
yields
array (
0 => 'a',
1 => 'a',
2 => '',
3 => 'é',
4 => '',
5 => 'óú',
6 => '&ú',
7 => 'ó&ú',
)
Note the corruption in elements 2, 4, and 6, but not in their quoted
counterparts 3, 5, and 7.
------------------------------------------------------------------------
[2012-01-18 11:53:48] tero dot tasanen at gmail dot com
I can also confirm that this is an actual bug. File encoding UTF-8, locale
settings are set correctly and characters like äöå are dropped from the
beginning
of the csv column.
Tested with php versions 5.2.6, 5.2.10, 5.3.6
------------------------------------------------------------------------
[2011-10-28 08:33:25] peter dot e dot lind at gmail dot com
This is definitely still a bug - my locale is set to da_DK.utf8, the file I'm
trying to read is in UTF8 (confirmed with a hex-editor but in fact does not
matter - the behaviour is the same, UTF8 or ISO-8859-1) yet special characters
are still thrown away when they are first in a field
------------------------------------------------------------------------
[2011-10-18 13:59:30] me at monicag dot it
Quoting my fellows above: how comes this is not a bug?
------------------------------------------------------------------------
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