Charset in filename

Topics: Developer Forum, User Forum
Apr 4, 2013 at 7:02 PM
Hi There,

Love the library. However, i am ripping my hair off trying to figure out how to get foreign characters in the filename. Is it even possible? Have a look at the following code saved in UTF-8.
    echo $levStringt."<br>";
    echo mb_detect_encoding($levStringt)."<br>";
    $apa = 'Duells DÄCK';
    echo $apa."<br>";
    echo mb_detect_encoding($apa)."<br>";

    $objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel); 
    $objWriter->save($apa); 
Output:

Duells DÄCK
UTF-8
Duells DÄCK
UTF-8

Filename : Duells DÄCK.xlsx

Allright. Wicked! Why? Let's save the file as ANSI.

Output:

Duells DÄCK
UTF-8
Duells D�CK.xlsx
UTF-8

Filename : Duells DÄCK.xlsx

SUCCESS! But, no wait! Let use the other variable levStringt.

The name of the filename : Duells DÄCK

Crap! What am i missing? Or am i just stupid :D
Coordinator
Apr 8, 2013 at 8:11 AM
This is not something that PHPExcel can control at all.... it depends what charset your Operating System filesystem is using. If your operating system filesystem supports UTF-8, then you can use UTF-8 characters. Windows platforms typically support the locale charset (though not guaranteed), so you'd need to use characters from the appropriate codepage, and use iconv() or mb_convert_encoding() to convert from ASCII or UTF-8 to the appropriate codepage character set.