Delete invisible ASCII chars which can generate errors.
<?php
gc_disable();
$content = file_get_contents("db.csv");
if ($content === false) {
echo "ERROR: impossible to read the file.";
die();
}
for($i = 0; $i < strlen($content); $i++) {
$ascii = ord($content[$i]);
if (($ascii < 32 or $ascii > 126) and $ascii != 10) {
$content[$i] = "?";
}
}
if (file_put_contents("new.csv", $content) === false) {
echo "ERROR: impossible to write the new file.";
}