Solution of Chinese Parameter Garbled Code in JS Value Transmission

  • 2021-07-01 06:16:59
  • OfStack

In this paper, the solution of Chinese parameter garbled code in JS value transmission is described with examples. Share it for your reference, as follows:

function PopupFK(cNum,type){
  var url = "contract!Paying.action";
  url = url + "?contract.contractNum="+cNum+"&payingType="+type;
// if(isEmpty($(_this).attr("payId"))){
// url = url + "&s_paymentId="+paymentId;
// url = url + "&s_paymentDtlId="+paymentDtlId;
// }else{
// url = url + "&s_payId="+$(_this).attr("payId");
// }
  url = url+"&random="+Math.random();
  // Here it is. Use encodeURI Transcoding twice. Backstage Action When receiving. In progress 1 Times. There will be no garbled problem 
  url = encodeURI(url);
  url = encodeURI(url);
    var ret = window.showModalDialog(

The following is an Action code snippet

String cNum = contract.getContractNum();
String Num;
try {
  Num = URLDecoder.decode(cNum,"utf8");
  c = csl.queryOneByNum(Num);
} catch (UnsupportedEncodingException e) {
  throw new RuntimeException(" Contract data error, please contact administrator ");

More readers interested in JavaScript can check the topic of this site: "Summary of JavaScript Value Transfer Operation Skills", "Summary of javascript Coding Operation Skills", "Summary of json Operation Skills in JavaScript", "Summary of JavaScript Switching Special Effects and Skills", "Summary of JavaScript Search Algorithm Skills", "Summary of JavaScript Animation Special Effects and Skills", "Summary of JavaScript Error and Debugging Skills", "Summary of JavaScript Data Structure and Algorithm Skills", "Summary of JavaScript Traversal Algorithm and Skills" and "Summary of JavaScript Mathematical Operation Usage"

I hope this article is helpful to everyone's JavaScript programming.

Related articles: