前后台交互 乱码 特殊符号问题备份
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("\"", "");