0

I'm new here and with coding. But i have a question about my .cvs file. I made an Exel document and there are French words in it, then i coverted it to .cvs so i can print it. But when my code reads it and tries to print it i get black diamond with a question mark in it. I already know why it does that but i have no idea how to let my code read it correctly.

This is the code i used:

function changeEncoding($filePath, $in, $out)
{
    $open = file_get_contents($filePath);
    file_put_contents($filePath, iconv($in, $out, $open));
}
if (($open = fopen("FILE.csv", "r")) !== FALSE)
{
    while (($data = fgetcsv($open, 1000, ",")) !== FALSE)
    {
        $array[] = $data;
    }

    fclose($open);
}
echo "<pre>";
//To display array data
var_dump($array);
echo "</pre>";

(Sorry if i made a few typos, my English is not that great haha)

0 Answers0