框架:SpringBoot3
问题:响应内容乱码
问题代码:
// 成功登录响应的内容@Overridepublic void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {response.setCharacterEncoding("utf-8");response.getWriter().write("成功登录");}});
我们设置了响应内容的字符编码为utf-8,看看结果
乱码了,但是我们将utf-8改成gbk就没有这个问题了