I've this string encoded on a lang file:
Équipe de référence
if is printed straight is not conveted to the right syntax, and is the same as the above:
Équipe de référence
So I have added an:
html_entity_decode();
and on my linux, libreoffice and open as downloaded CSV works too.
But If I open it on windows/mac text editor or Excel is printed like:
Équipe de référence
All is UTF8 encoded, so I cannot understand what I am doing wrong.
The question is not about "open a file correctly", is about encoded string and how to print them correctly.
So for example, adding:
if you want make UTF-8 file for excel, use this:
$fp = fopen($filename, 'w');
//add BOM to fix UTF-8 in Excel
fputs($fp, $bom =( chr(0xEF) . chr(0xBB) . chr(0xBF) ));