#34735 [Opn->Bgs]: fgetcsv() lost with low or high value ascii chars

From: Date: Tue, 04 Oct 2005 18:50:14 +0000
Subject: #34735 [Opn->Bgs]: fgetcsv() lost with low or high value ascii chars
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-86017@lists.php.net to get a copy of this message
ID: 34735 Updated by: tony2001@php.net Reported By: fcartegnie at nordnet dot fr -Status: Open +Status: Bogus Bug Type: Strings related Operating System: Linux PHP Version: 4.4.0 New Comment: Change this line: $data = fgetcsv ($fp, 8192, '\xF0', ''); to $data = fgetcsv ($fp, 8192, "\xF0", ''); and you'll get what you expect. Not a bug, as '\xF0' is string(4). Previous Comments: ------------------------------------------------------------------------ [2005-10-04 17:43:02] fcartegnie at nordnet dot fr Description: ------------ fgetcsv does not handle extended ascii as separator or enclosure. This code does not works with 0xF0 (chr 240), and/or with enclosures (0xF1, ...) while it works with common comma/quotes. Tested also with setting up/changing locale. Reproduce code: --------------- $fp = fopen("test.csv", "w"); fwrite($fp, "A\xF0B\xF0C\xF0D"); fclose($fp); $fp = fopen("test.csv", "r"); $data = fgetcsv ($fp, 8192, '\xF0', ''); fclose($fp); print_r($data); Expected result: ---------------- Array ( [0] => A [1] => B [2] => C [3] => D ) Actual result: -------------- Array ( [0] => AðBðCðD ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=34735&edit=1

« previous php.bugs (#86017) next »