when download a file named with english and num and chinese character,the file name is garbled

Petite Abeille petite.abeille at gmail.com
Tue Feb 3 22:15:29 MSK 2009


On Feb 3, 2009, at 10:14 AM, lhmwzy wrote:

> When download a  file  named with english and num and chinese
> character,巧虎快乐版2008年12月号DVD0812.iso,for example,the file name  
> will
> garbled like "%c7%c9%bb%a2%bf%ec%c0%d6%b0%e62008%c4%ea12%d4%c2%ba 
> %c5DVD0812.iso",

It should be

%e5%b7%a7%e8%99%8e%e5%bf%ab%e4%b9%90%e7%89%882008%e5%b9%b412%e6%9c 
%88%e5%8f%b7DVD0812.iso

instead, if I'm not mistaken.

E.g. UTF-8 + Percent-encoding (aka URL encoding) [1]

That said, because this data came via a HTML <form>, it might have  
been encoded using the form's accept-charset instead of UTF-8:

http://www.w3.org/TR/html401/interact/forms.html#adef-accept-charset

> how to solve the problem?

(1) Percent decode the file name
(2) Convert the resulting byte stream into an Unicode representation  
using the appropriate character set encoding

Nothing to do with nginx though....

HTH.

Cheers,

--
PA.
http://alt.textdrive.com/nanoki/


[1] http://en.wikipedia.org/wiki/Percent-encoding




More information about the nginx mailing list