#49168 [Opn->Fbk]: fgetcsv closure missbehaves when using '§' as closure

From: Date: Wed, 05 Aug 2009 10:43:27 +0000
Subject: #49168 [Opn->Fbk]: fgetcsv closure missbehaves when using '§' as closure
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-140677@lists.php.net to get a copy of this message
ID: 49168 Updated by: derick@php.net 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

« previous php.bugs (#140677) next »