使用fileupload上传文件,有些浏览器会出现乱码. 使用setHeaderEncoding就可以解决.
ServletFileUpload upload = new ServletFileUpload(factory);
String charset = request.getCharacterEncoding();
if (charset != null) {
upload.setHeaderEncoding(charset);
}
String charset = request.getCharacterEncoding();
if (charset!=null) value = item.getString(charset);
else value = item.getString();