I'm using this code to read the text from a .txt file and then output the first 350 chars in html code (the idea is to show the beginning of an article and if the user is interested he clicks to read the whole thing)
$text=trim(file_get_contents($filename));
//350 chars
$text=substr($text, 0, 350);
echo $text;
the problem is that, for example, when it reads this text from the .txt file:
Furtado, a first-generation Portuguese Canadian, was born as one of three children in Victoria, British Columbia to Maria Manuela and António José Furtado, working-class Portuguese parents from São Miguel Island in the Azores. She was named after Soviet gymnast Nellie Kim.
it looks like this in the browsser
п»їFurtado, a first-generation Portuguese Canadian, was born as one of three children in Victoria, British Columbia to Maria Manuela and AntГіnio JosГ© Furtado, working-class Portuguese parents from SГЈo Miguel Island in the Azores. She was named after Soviet gymnast Nellie Kim. [1] Furtado's parents emigrated from Portugal to Canada in the late...
Notice the few weird characters (п»ї😉 in the beginning, before "Furtado" ?
That's the problem, i don't have idea from where there are coming and they are supposed to NOT be there....
p.s.
yup, the text in the .txt files starts from the very beginning of the .txt wihout spaces or anything else before the text