In IDEA embedded Tomcat8 normal environment, the Windows deployment Tomcat8 not normal, return the wrong signature, because tomcat default encoding using the ISO-8859-1 encoding parser, garbage problem as long as you can read the code to specify the HttpServletRequest solve
ServletInputStream inStream = request.getInputStream();
String resp = getStrFromInsByCode(inStream, "utf-8");
/**
*
* @param is 输入流
* @param code 指定读取编码
* @return
*/
public static String getStrFromInsByCode(InputStream is, String code) {
StringBuilder builder = new StringBuilder();
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(is, code));
String line;
while ((line = reader.readLine()) != null) {
builder.append(line + "\n");
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return builder.toString();
}