Home > Java > javaTutorial > What to do if java word is garbled

What to do if java word is garbled

藏色散人
Release: 2020-04-05 09:36:51
Original
2741 people have browsed it

What to do if java word is garbled

#What should I do if the java word is garbled?

Java save Word and solve the garbled problem

* 专家意见另存word
*@YaoWei
*2014-6-16 下午12:09:07
* @param request
* @param response
* @return
*/
public static String saveExpertOptionAsWord(HttpServletRequest request, HttpServletResponse response){
ExpertCheckService.getOptionInfo(request, response);
//生成最终的下载附件的名称
@SuppressWarnings("unchecked")
Map<String, String> corpInfoMap = (Map<String, String>) request.getAttribute("corpInfoMap");
String fileName = "建筑业企业资质审查情况登记表["+corpInfoMap.get("corpName")+"].doc";
try {
//解决中文乱
fileName = new String(fileName.getBytes("GB2312"),"ISO8859-1");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
//设置返回信息为word格式
response.setContentType("application/msword"); 
    response.setHeader("Content-disposition","attachment;filename="+fileName);
return "success";
}
Copy after login

Recommended tutorial: "java learning"

The above is the detailed content of What to do if java word is garbled. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Install JAVA
From 1970-01-01 08:00:00
0
0
0
Unable to install java
From 1970-01-01 08:00:00
0
0
0
Can java be used as the backend of the web?
From 1970-01-01 08:00:00
0
0
0
Is this in Java language?
From 1970-01-01 08:00:00
0
0
0
Help: JAVA encrypted data PHP decryption
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template