ID: 49168
Updated by: [email protected]
Reported By: axel77 at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: Filter related
Operating System: Ubuntu Linux
PHP Version: 5.2.10
New Comment:
Are you sure you're using a single byte character for §?
Previous Comments:
------------------------------------------------------------------------
[2009-08-05 10:33:56] axel77 at gmail dot com
Description:
------------
I was using '§' as closure, since this was the only character I fairly
didn't even expect to encounter, without having to use any escaping.
It does not work. It will always add an additional trailing '§' on the
data received.
Reproduce code:
---------------
--- reproduce.php ---
<html>
<style type="text/css">
table {border-collapse: collapse;}
td {border: 1px solid;}
</style>
<body><table><tbody>
<?php
if (($handle = fopen('data', 'r')) === FALSE) {
echo '<h1>ERROR: Unable to read data.</h1>';
exit;
}
while (($data = fgetcsv($handle, 1000, ',', '§')) !== FALSE) {
echo "<tr><td>$data[0]</td>";
echo "<td>$data[1]</td>";
echo "<td>$data[2]</td></tr>";
}
fclose($handle);
?>
</tbody></table></body></html>
-----------------
--- data ---
abm, §anjn an§, aaa
abm, anjn an, aaa
-----------------
Expected result:
----------------
abm | anjn an | aaa
abm | anjn an | aaa
Actual result:
--------------
abm | anjn an§ | aaa
abm | anjn an | aaa
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49168&edit=1