Ajax乱码

来源:互联网 发布:python split 编辑:程序博客网 时间:2024/04/29 07:54


背景:项目统一编码GBK


前台js传给服务端,服务端接收到的是乱码:

前台js:

keywords: encodeURI(keywords)
服务端接收:

keywords = java.net.URLDecoder.decode(keywords.trim(), "UTF-8");



服务端返回结果,前台接收乱码:

response.setCharacterEncoding("GBK");...response.getWriter().print(jsonStr);