标签:tomcat ram name tty character ext string bytes 字符编码
post
响应编码
response.setContentType(“text/html;charset=UTF-8”);
response.setCharacterEncoding("UTF-8");
一般设置响应体用第一种
get
请求编码 Tomcat-9会出现乱码
String name = request.getParameter("name"); byte[] bytes = name.getBytes("ISO8859");//打散:将name字符串按照原编码进行打散 name=new String(bytes,"utf-8");//组装:将bytes字节数组按照指定字符编码进行组装,组装为String
标签:tomcat ram name tty character ext string bytes 字符编码
原文地址:https://www.cnblogs.com/rzkwz/p/12386873.html