tags:

views:

6

answers:

1

Hi I want to read a csv file line by line. i have written code but it give output in encrypted manner . my code is

$row = 1;
$handle = fopen($_FILES['csv']['tmp_name'], "r");
 while (($data = fgetcsv($handle, 1000,",")) != FALSE) {
        $num = count($data);
        echo "<p> $num fields in line $row: <br /></p>\n";
        $row++;
        for ($c=0; $c < $num; $c++) {
            echo $data[$c] . "<br />\n";
        }
    }
    fclose($handle);
A: 

This is basically exactly the same as example #1 in the PHP fgetcsv() docs. Check your input file, as there's nothing really in here that would "encrypt" data. If the file's encoded in a foreign character set, and you're outputting on ISO-8859, then you will get "encrypted" output.

Marc B