ID:               37942
 User updated by:  bugs dot php dot net_alex at gareis dot info
 Reported By:      bugs dot php dot net_alex at gareis dot info
-Status:           Open
+Status:           Bogus
 Bug Type:         Filesystem function related
 Operating System: Linux (Debian)
 PHP Version:      5.1.4
 New Comment:

Obviously i was wrong.

Though calls to setlocale() resulted in no error, they did not have any
effect, as "locales" was not installed on the systems where the error
was reproduced.

Now, with working locales and setting "en_US.iso8859-1" the CSVs parse
just fine.


Previous Comments:
------------------------------------------------------------------------

[2006-06-28 08:43:22] bugs dot php dot net_alex at gareis dot info

Description:
------------
Despite the correct locale settings, fgetcsv strips characters from the
beginning of a field, if the field is not quoted correctly.

Reproduced with PHP 5.1.2-Debian-0.1~sarge1, PHP 5.1.4-1.dotdeb.2,
locales en_US, en_US.UTF-8, POSIX.

NOT reproduced with PHP 5.0.5-2ubuntu1.2 (en_US.UTF-8),
5.1.4-Debian-0.1~sarge1 (en_US)

Might actually not be a bug, but a documentation problem - however, i
do not think this related to the similar bug reports present.

Reproduce code:
---------------
#!/usr/local/bin/php -Cq
<?php

if (is_file('temp')) die("temp!\n");

$fcontent = 'foo,öbar,®¯°ä»,"öbar","®¯°ä»"';
file_put_contents('temp', $fcontent);
echo 'plain: '.file_get_contents('temp')."\n\nfgetcsv: ";
$fp = fopen('temp', 'r');
print_r(fgetcsv($fp, 1024, ',', '"'));
fclose($fp);
unlink('temp');

?>


Expected result:
----------------
plain: foo,öbar,®¯°ä»,"öbar","®¯°ä»"

fgetcsv: Array
(
    [0] => foo
    [1] => öbar
    [2] => ®¯°ä»
    [3] => öbar
    [4] => ®¯°ä»
)


Actual result:
--------------
plain: foo,öbar,®¯°ä»,"öbar","®¯°ä»"

fgetcsv: Array
(
    [0] => foo
    [1] => bar
    [2] =>
    [3] => öbar
    [4] => ®¯°ä»
)



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=37942&edit=1

Reply via email to