2015-06-16 57 views
0

如何在字符集utf-8中上傳文件和值?JSP + Servlet +多部分/表單數據格式UTF-8

request.setCharacterEncoding("UTF-8"); 
response.setCharacterEncoding("UTF-8"); 
response.setContentType("text/html;charset=UTF-8"); 
MultipartFormDataRequest mrequest = new MultipartFormDataRequest(request); 
out.print("NAME iS: " + mrequest.getParameter("name")); 

輸出:

بÙاخبÛتاخØ

回答

0
out.print("NAME iS: " + new String (mrequest.getParameter("name").getBytes ("iso-8859-1"), "UTF-8")); 
相關問題