0
I am file() to a file and it returns between each letter of the document.
alpha dic.
Adão
Andy
Code:
$dictionary = file('alfa.dic', FILE_IGNORE_NEW_LINES);
var_dump:
string '�A�d�ã�o�' (length=9)
string '�A�n�d�y�' (length=9)
I thought it was a charset problem but even using utf8_encode()
this does not remove characters.
How can I clear each line of these unknown characters?
Do you know what the charset of that file is? In which OS are you doing it?
– gabrielhof
the charset of the file is
'UTF-16 LE with BOM'
– CIRCLE
Have you tried using iconv? iconv('UTF-16LE', 'UTF-8', $string_do_file);
– gabrielhof
If not, try mb_convert_encoding: mb_convert_encoding($string_do_file , 'UTF-8' , 'UTF-16LE');
– gabrielhof
Well, anyway, take a look at this question: http://stackoverflow.com/questions/6980068/how-to-convert-utf-16le-to-utf-8-in-php
– gabrielhof