response.setCharacterEncoding("UTF-8");
response.setContentType("application/json; charset=utf-8");
PrintWriter out = response.getWriter();
JSONObject res = new JSONObject();
res.put("msg", "错误");
res.put("success", "false");
out.append(res.toString());
参考文章:https://blog.csdn.net/u012201619/article/details/75156707/