首先,不要用get传中文,我试了一些方法发现不行,所以果断决定用post传参,

这里用 encodeURI 进行一次编码传入后端

注意:${tplname} 要加 '

        $.ajax({
            url: '/RM/controller/json/ConfigTemplateCustomController/fetchTemplateCustomContentsByTplName/tplname/post',
            type: 'POST',
            async: false,
            data:{
              'tplname':encodeURI('${tplname}')
            },
            success:

 

这样解码后再 getBytes 就解决了

    @RequestMapping(value = "controller/json/ConfigTemplateCustomController/fetchTemplateCustomContentsByTplName/tplname/post", method = RequestMethod.POST)
    @ResponseBody
    public BaseResult fetchTemplateCustomContentsByTplName(String tplname) throws UnsupportedEncodingException {
        tplname = URLDecoder.decode(tplname,"utf-8");
        tplname =  new String(tplname.getBytes("ISO-8859-1"),"UTF-8");
        return ResultUtil.success().add("TemplateCustom", configTemplateCustomService.selectByPrimaryKey(tplname));
    }

 

相关文章:

  • 2021-05-27
  • 2022-12-23
  • 2021-07-14
  • 2021-12-21
  • 2022-01-18
  • 2022-12-23
  • 2021-09-13
  • 2022-12-23
猜你喜欢
  • 2021-10-28
  • 2022-01-01
  • 2021-06-17
  • 2022-01-09
  • 2022-02-15
  • 2021-09-17
  • 2022-12-23
相关资源
相似解决方案