Bug #72861 [Opn->Fbk]: fgetcsv get line error
| From: | cmb@php.net | Date: | Thu, 13 Sep 2018 16:56:06 +0000 |
| Subject: | Bug #72861 [Opn->Fbk]: fgetcsv get line error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-217034@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72861&edit=1
ID: 72861
Updated by: cmb@php.net
Reported by: zhouliweb at sina dot com
Summary: fgetcsv get line error
-Status: Open
+Status: Feedback
Type: Bug
Package: Filesystem function related
Operating System: Win
PHP Version: 7.0.9
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
I can't reproduce this. Is a.csv actually UTF-8 encoded? Are you
using an UTF-8 locale (LC_CTYPE)?
Previous Comments:
------------------------------------------------------------------------
[2016-08-17 03:11:30] zhouliweb at sina dot com
Description:
------------
While has japanese in the csv, fgetcsv get line error. More detail see the test script.
Test script:
---------------
$filename = "a.csv";
$file = fopen($filename, "r");
while(!feof($file) && $data = fgetcsv($file)) {
echo json_encode($data) . "\n";
}
fclose($file);
a.csv is like this:(3 lines, the first line is unix LF, others is windows CR+LF)
"a
ã¾ãããã"
b
Expected result:
----------------
["a\n\u307e\u3057\u3087\u3046\u3002"]
["b"]
Actual result:
--------------
["a\n\u307e\u3057\u3087\u3046\u3002\"\r\nb\r\n"]
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72861&edit=1