The problem of Chinese JavaEE download the file name is not displayed

  When we do JavaEE project download files in the familiar UTF-8 encoded file names often find Chinese garbled, Chinese and other conditions are not displayed, this time, the text

The change filename encoding might solve this trouble:

  fileName = new String(fileName.replace(" ", "_").getBytes("UTF-8"), "ISO-8859-1");

Note: replaces spaces with underscores for spaces in file names are truncated to prevent the download firefox]

Because http protocol default encoding transmission is iso-8859-1, tomcat also default to ISO-8859-1 code set, so we turned this will solve a set of coding

Part of the problem garbled. Of course, JavaEE project possible causes Chinese garbled lot, summarized below lists some of the Internet, thanks to a small partner to share!

 

http://www.ibm.com/developerworks/cn/java/j-lo-chinesecoding/

http://www.cnblogs.com/yezhenhan/archive/2011/01/14/1935376.html

 

Reproduced in: https: //www.cnblogs.com/jimmy-c/p/4124747.html

Guess you like

Origin blog.csdn.net/weixin_34221332/article/details/93611058