进行转码
@RequestMapping("querySupplyToJSON")
@ResponseBody
public List<Supply> querySupplyByJson(Supply supply) throws UnsupportedEncodingException{
String str = new String(supply.getGongyingshangname1().getBytes("ISO-8859-1"), "utf-8");
System.out.println("====="+supply.getGongyingshangname1()+"===="+str);
return supplyService.queryAll();
}
控制台的结果,转码前和转码后的结果
[DEBUG] 2018-09-15 16:42:05,261 org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'supplyController'
[DEBUG] 2018-09-15 16:42:05,261 org.springframework.web.servlet.DispatcherServlet - Last-Modified value for [/bookTest/querySupplyToJSON] is: -1
=====é??====陕
[DEBUG] 2018-09-15 16:42:05,289 org.mybatis.spring.SqlSessionUtils - Creating a new SqlSession