php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48353 fgetcsv() inserts whitespaces
Submitted: 2009-05-21 10:06 UTC Modified: 2009-05-21 12:13 UTC
From: uhp at gmx dot net Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 5.2.9 OS: Debian lenny
Private report: No CVE-ID: None
 [2009-05-21 10:06 UTC] uhp at gmx dot net
Description:
------------
I'm native german, so I hope you understand my problem.

fgetcsv inserts whitespaces after each character. The file looks like

Campaign	Campaign Daily Budget

I think the same problem is described here

http://bugs.php.net/bug.php?id=31632

but I don't know if my file is also unicode-encoded

Reproduce code:
---------------
$handle = fopen("./test.csv", "r");
$headlines = fgetcsv($handle, 1000, "\t");
print_r($headlines);

Expected result:
----------------
Array
(
    [0] => Campaign
    [1] => Campaign Daily Budget
    [2] => Ad Group
}

Actual result:
--------------
Array
(
    [0] => C a m p a i g n 
    [1] =>  C a m p a i g n   D a i l y   B u d g e t 
    [2] =>  A d   G r o u p
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-05-21 12:13 UTC] jani@php.net
Obviously it is utf-8 encoded.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 04:01:38 2024 UTC