Url-based Chinese delivery solution
1. Set the web. config file. (I don't like setting it like this)
<System. web>
......
<Globalization requestEncoding = "gb2312" responseEncoding = "gb2312" culture = "zh-CN" fileEncoding = "gb2312"/>
......
</System. web>
2. Before passing Chinese characters, encode the Chinese parameters to be passed and decode them upon receiving them.
> Transfer
String Name = "Chinese parameter ";
Response. Redirect ("B. aspx? Name = "+ Server. UrlEncode (Name ));
> Receive
String Name = Request. QueryString ["Name"];
Response. Write (Server. UrlDecode (Name ));
3. If a Chinese parameter is transferred from the. HTML file to the. Aspx file (that is, Url conversion is not performed using the Redirect () method from the background ). Similarly, the passed Chinese parameters must be encoded and decoded upon receiving.
> Transfer
<Script language = "JavaScript">
Function GoUrl ()
{
Var Name = "Chinese parameter ";
Location. href = "B. aspx? Name = "+ escape (Name );
}
</Script>
<Body onclick = "GoUrl ()">
> Receive
String Name = Request. QueryString ["Name"];
Response. Write (Server. UrlDecode (Name ));
In general. Set the web. config file. However, if you use JavaScript to call the webservice method (passing Chinese parameters to webservice ). The web. config file is invalid.
---------------------------------------------------------------