前后台交互 乱码 特殊符号问题备份

1、乱码问题 

前台:var areaname = encodeURI(encodeURI(name))

后台:areaname = URLDecoder.decode(areaname,“UTF-8”);

2、特殊符号 

前台 进行加密
 var ordername=$("#hpGoodscodeName1").val();
             var businessInfoJSON = JSON.stringify(ordername);
             var businessInfoBase64 = window.btoa(encodeURIComponent(businessInfoJSON));
             var url = "ldcHandbookPieceController.do?selectldcgoods&type="+type1+"&goodscode="+ businessInfoBase64;
后台解密
            String goodscode = request.getParameter("goodscode");
            goodscode = new String(Base64.getDecoder().decode(goodscode));
            goodscode = URLDecoder.decode(goodscode, "UTF-8").replace("\"", "");

 

posted @ 2020-08-24 16:59  薛柏梁  阅读(345)  评论(0编辑  收藏  举报