http://www.perlmonks.org?node_id=1205117

hankcoder has asked for the wisdom of the Perl Monks concerning the following question:

This URI escape for Chinese character has being bugging me for quite sometime.

I have a filename saved in my data with mixed letters so as Chinese characters in base64 encoded. However, when I execute a file Download request, I unable to get the save file to appear back to original Chinese characters filename. I'm not sure if it can be done or not. For now, they are all in standard uri_escape.

I also tried using uri_escape_utf8 result still same. It will become something like "...chinese%20%27%E9%A1%B6%E9%A1%B6.....png". The original Chinese filename is "chinese '顶顶顶顶' & 123.png" just for testing.

In download script;

use URI::Escape; .... $fname = uri_escape($fname); .... print "Content-length: $fsize\n"; print "Content-Disposition: attachment; filename=$fname\n"; print "Content-Type: application/force-download;\n\n"; ....

The download script works fine. Just when download file that contain Chinese characters filename, I can't get it Save in Chinese characters. The filename stored in my data base64 are decoded properly.

Could someone please give me some suggestions or that is just the way how it works? Many thanks.