Springmvc中@RequestParam传值中文乱码解决方案(转)

    @RequestMapping(value={"/list"},method=RequestMethod.GET)
    @ResponseBody
    public DeviceList getdevicelist(HttpServletRequest request, HttpServletResponse response) {
        

        String m_unit=request.getParameter("khnuit");
        m_unit=EncodingTool.encodeStr(m_unit);
        DeviceList ds=new DeviceList(deviceService.find(m_unit),1,0,20);
        return ds;
    }
    public static class EncodingTool {  
        public static String encodeStr(String str) {  
            try {  
                return new String(str.getBytes("ISO-8859-1"), "UTF-8");  
            } catch (UnsupportedEncodingException e) {  
                e.printStackTrace();  
                return null;  
            }  
        }  
    }  

原文地址:http://luanxiyuan.iteye.com/blog/1849169

原文地址:https://www.cnblogs.com/swack/p/5616820.html