Commit 4a9692aa authored by 张永's avatar 张永

1

parent aa71e6cf
package com.egolm.common.web; package com.egolm.common.web;
import java.io.UnsupportedEncodingException;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.net.URLEncoder;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.util.Enumeration; import java.util.Enumeration;
...@@ -69,4 +71,18 @@ public class ServletUtil { ...@@ -69,4 +71,18 @@ public class ServletUtil {
return json; return json;
} }
} }
public static String covertFileName(HttpServletRequest request, String fileName)throws UnsupportedEncodingException {
String userAgent = request.getHeader("User-Agent").toLowerCase();
System.out.println(userAgent);
String excelFileName = "";
if (userAgent.indexOf("msie") != -1) {// IE浏览器
excelFileName = URLEncoder.encode(fileName, "UTF8");
} else if (userAgent.indexOf("firefox") != -1) {// google,火狐浏览器
excelFileName = new String(fileName.getBytes(), "ISO-8859-1");
} else {
excelFileName = URLEncoder.encode(fileName, "UTF8");// 其他浏览器
}
return excelFileName;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment