URL-based Chinese delivery solution
1. Set the Web. config file. < 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 Parameters " ;
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.
Codec in HTML:
< Script Language = "JavaScript" >
Function Openurl (SRC)
{
VaRStrurl=Escape (SRC );
Window. Open (strurl );
}
Function Change_url (SRC)
{
Document. Location. href=Escape (SRC );
}
</ Script >
Save in new window
< A Href = 'Javascript: Openurl ("CSS/20040603123628transaction center tobacco leaf online concentrated transaction system contract .doc ");' > 20040603123628 transaction center online centralized transaction system contract </ A >
The current location is saved without blinking.
< A Href = "#" Onclick = Javascript: change_url ("CSS/20040603123628transaction center tobacco leaf online concentrated transaction system contract .doc ") > 20040603123628 transaction center online centralized transaction system contract </ A >
Note: The slash in the path is "/" rather than "\". Otherwise, it will not work.