1. Set up the Web. config file.
<system.web>
......
<globalization requestencoding= "gb2312" responseencoding= "gb2312" culture= "ZH-CN" fileencoding= "gb2312"/>
......
</system.web>
2. Before passing the Chinese, the Chinese parameter to be passed is encoded, and then decoded when it is received.
>> for delivery
String Name = "Chinese parameter";
Response.Redirect ("B.aspx? Name= "+server.urlencode (Name));
>> to receive
String name = request.querystring["Name"];
Response.Write (Server.urldecode (Name));
3. If it is from. HTML file to. Aspx file to pass the Chinese parameter (that is, no Url translation from the background using the Redirect () method). It is necessary to encode the passed Chinese parameters and decode them when they are received.
JS in:
The escape () function encodes the string so that it can be read on all computers
You can use Unescape () to decode an escape () encoded string.
>> for delivery
<script language= "JavaScript" >
function Gourl ()
{
var Name = "Chinese parameter";
Location.href = "B.aspx?" Name= "+escape (Name);
}
</script>
<body onclick= "Gourl ()" >
>> to receive
String name = request.querystring["Name"];
Response.Write (Server.urldecode (Name));
Generally speaking. You can set the Web. config file. But if you call the WebService method with JavaScript (pass the Chinese parameter inside the WebService). Setting the Web. config file looks invalid.
Server.URLEncode and Server.urldecode (solution for URL delivery in Chinese)