if (mb_detect_encoding($line, 'UTF-8', true) === false) {$line = utf8_encode($line);} $line = mb_convert_encoding($line, 'UTF-8', 'OLD-ENCODING');