public String chStr(String string)
{
if(string==null){
string="";
}
else{
try{
string=(new String(string.getBytes("iso-8859-1"),"GB3212")).trim();
}catch(Exception e){
e.printStackTrace(System.err);
}
}
return string;
}
{
if(string==null){
string="";
}
else{
try{
string=(new String(string.getBytes("iso-8859-1"),"GB3212")).trim();
}catch(Exception e){
e.printStackTrace(System.err);
}
}
return string;
}
還是以下代碼實用
.傳遞中文之前,將要傳遞的中文參數進行編碼,在接收時再進行解碼。
>> 進行傳遞
string Name = "中文參數";
Response.Redirect("B.aspx?Name="+Server.UrlEncode(Name))
>> 進行接收
string Name = Request.QueryString("Name")
Response.Write(Server.UrlDecode(Name))