Home » File System » File » Bug #7369
import csv with tab seperator fail
Details
| Submitted | 2006-04-11 16:52 UTC |
|---|---|
| From | jmab70 at hotmail dot com |
| Assigned | dufuz |
| Status | No Feedback |
| Package | File |
| PHP Version | 4.4.0 |
| OS | Win XP SP2 |
| Roadmaps | (Not assigned) |
Comments
[2006-04-11 16:52 UTC] jmab70 at hotmail dot com
Description:
------------
i join a csv file that dont work fine
seperator is tab
but File_CSV::discoverFormat choose "," sep
Test script:
---------------
require_once('File/CSV.php');
$file= $Config_upload_tmp_files."/".$tmp_name;
$conf = @File_CSV::discoverFormat($file);
$data2=array();
while ($data = @File_CSV::read($file, $conf)) {
$data2 =array_merge($data2,$data);
}
$fp=@File_CSV::getPointer($file, &$conf);
fclose($fp);
@unlink ($file);
Expected result:
----------------
The csv file is :
Axxxfs 02xxx0 00xxxxx84 11 10/04/06 2163,53
10/04/06 VIREMENT RECU TIERS VIR ACOMPTE PAIEMENT FC 904 11/04/06 700,00
10/04/06 CHEQUE N° 646 08/04/06 -33,61
07/04/06 REMISE CHEQUES BORDEREAU 05242 11/04/06 1237,93
05/04/06 PRELEVEMENT PL PROVINCE 05.04.0 04/04/06 -78,00
04/04/06 COMMISSION TTC FACTURE NUMERO 038 10/04/06 -29,90
27/03/06 CHEQUE N° 645 25/03/06 -34,01
24/03/06 CHEQUE N° 614 22/03/06 -32,75
22/03/06 CHEQUE N° 643 20/03/06 -273,00
21/03/06 FACTURE CARTE DU 190306 TOTAL CART 21/03/06 -32,00
20/03/06 PRELEVEMENT URSSAF 19/03/06 -75,00
16/03/06 VIRT CPTE A CPTE EMIS VT 17H18 02 15/03/06 -1000,00
15/03/06 CHEQUE N° 641 13/03/06 -100,07
14/03/06 PRELEVEMENT TELECOM 06 REF 13/03/06 -29,99
14/03/06 CHEQUE N° 642 12/03/06 -30,00
Actual result:
--------------
result on 2 colonnes
[2006-04-11 22:29 UTC] jmab70 at hotmail dot com
i resolve my problem by changing the line 449 :
$times[$num] = (isset($times[$num])) ? $times[$num] + 1: 1;
by
$times[$num] = (isset($times[$num])) ? $times[$num] + $num : 1;