Search code examples
phpcharacter-encodingurlencodebig5

Website Downloading File with Traditional Chinese file name


Wanting to download this file :

http://jamie-is-cool.comeze.com/files/download/Test/%a4%e5%a6r%aa%ba%b0_%b7%bd%a9M%b5o%aei.ppt

which is named

文字的起源和發展.ppt

in traditional Chinese, but instead the name was displayed as

¤å¦rªº°_·½©Mµo®i.ppt

in the original directory page (without index.php / index.html etc.) and the link to download is above.

What can I do, in a php, to turn traditional Chinese (BIG5) to the text (¤å¦rªº°_·½©Mµo®i.ppt) shown above, so that I can create a link to download that, in PHP?


Solution

  • set the files encoding to ansi with notepad++ or whatever

    and try this

    echo mb_convert_encoding($filename,'cp950','utf8');
    

    or try this

    echo mb_convert_encoding($filename,'big-5','utf8');