We are doing the Java EE Project download file, in our familiar with the UTF-8 code often found the file name in Chinese garbled, Chinese do not display the situation, at this time, the text
Changing the name of the code may solve this problem:
FileName = new String (Filename.replace ("", "_"). GetBytes ("UTF-8"), "iso-8859-1");
Note: The space is replaced by an underscore to prevent the file name from being truncated when it is downloaded by Firefox.
Because the HTTP protocol is the default transmission encoding is ISO-8859-1,TOMCAT also default to use the ISO-8859-1 encoding set, so we turn to this code set will solve a
Part of the problem of garbled. Of course, Java EE project in the cause of Chinese garbled is a lot of reasons, listed below some of the online summary, thanks to the small partners to share!
http://www.ibm.com/developerworks/cn/java/j-lo-chinesecoding/
Http://www.cnblogs.com/yezhenhan/archive/2011/01/14/1935376.html
Java EE download file name does not display the Chinese problem