欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

controller返回中文字符串,网页中文字符显示 “???”

程序员文章站 2022-04-03 08:52:52
...
@RequestMapping(value = "/test", method = RequestMethod.GET, produces = "text/plain;charset=UTF-8")
	@ResponseBody
	public String getSinfo(HttpServletRequest request,
			HttpServletResponse response) {
		response.setCharacterEncoding("utf8");
		response.setContentType("text/plain; charset=utf-8");
		String testJson = "{" + "'message': '信息'," + "'success': 'true',"
				+ "'result': {" + " 'id': 'ddd'," + " 'xxxx': {"
				+ "    'fssj': '2018-05-02 10:10:00'," + "   'fsdd': 'XX地方',"
				+ "'jb': '2级'" + "}" + "}" + "}";
		return testJson;
	}

 

相关标签: 中文乱码