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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: uhp at gmx dot net
New email:
PHP Version: OS:

 

 [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

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-05-21 12:13 UTC] jani@php.net
Obviously it is utf-8 encoded.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 15:01:35 2025 UTC