Several methods of dealing with Chinese garbled characters on the page

 

Several methods of dealing with Chinese garbled characters on the page

1. Nested in js with

 

window.location.href="http://localhost:8081/web/conObj/buyDetail.do?txt_conobj_key="+objKey+"&txt_contrade_kind="+CONTRADE_KIND+"&pick_types=A&jianjibuynum=0&order_prices="+orderPrice+"&cdListKeyArrayFront="+""+"&buyNum="+chatNum+"&ARTNFLAG="+ARTNFLAG+"&CNT_KEY="+CNT_KEY+"&msg="+encodeURIComponent(retMsg.msg);

encodeURIComponent($("#q").val())

 

 

 

Java background turn down

String query = request.getParameter("q");

query = new String(query.getBytes("ISO-8859-1"), "UTF-8");

 

2, nested in jsp with

<%

   String file_name=java.net.URLEncoder.encode("Log information list.xls","UTF-8") ;

   response.setHeader("Content-disposition","attachment; filename="+file_name);

   //The above line sets the file name when it is sent to the front-end browser test1.xls

   //It is this line that makes the front-end browser think that it has received an excel file 

%>

 

String MSG2 =URLDecoder.decode(msg, "utf-8");

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326427922&siteId=291194637
Recommended