Javaweb 网页前端提交中文数据传到IDEA控制台乱码
dopost方法
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//设置请求体的字符集为UTF-8从而解决post请求的中文乱码问题
req.setCharacterEncoding("UTF-8");
点击Tomcat Edit configuration
找到VM options添加如下代码
-Dfile.encoding=UTF-8