Replace this line $csv_data = mb_convert_encoding($csv_data, 'UTF-16LE', 'UTF-8'); to echo "\xEF\xBB\xBF"; // UTF-8 BOM
Replace this line $csv_data = mb_convert_encoding($csv_data, 'UTF-16LE', 'UTF-8'); to echo "\xEF\xBB\xBF"; // UTF-8 BOM