When creating a project, you need to perform keyword analysis on the (Internet) Search Engine import link.
Google uses js'Encodeuri () function, which can be used directlyDecodeuri () decoding.
Baidu uses:
System. Web. httputility. urlencode ("encoding", system. Text. encoding. getencoding ("gb2312") encoding,
Decoding requires:
System. Web. httputility. urldecode ("% B1 % E0 % C2 % Eb", system. Text. encoding. getencoding ("gb2312 ")));
This requires ASP. net c #. The following provides a method for decoding JavaScript operations.
<Script language = "VBScript">
Function str2asc (strstr)
Str2asc = hex (ASC (strstr ))
End Function
Function asc2str (ascasc)
Asc2str = CHR (ascasc)
End Function
</SCRIPT>
Urlencode:
Urlencode
Function urlencode (STR)
{
VaR ret = "";
VaR strspecial = "! \ "# $ % & () * +,/:; <=>? [] ^ '{| }~ % "; Var TT = "";
For (VAR I = 0; I <Str. length; I ++)
{
VaR CHR = Str. charat (I );
VaR c = str2asc (CHR );
Tt + = CHR + ":" + C + "N ";
If (parseint ("0x" + C)> 0x7f)
{
RET + = "%" + C. Slice (0, 2) + "%" + C. Slice (-2 );
}
Else
{
If (CHR = "")
RET + = "+ ";
Else if (strspecial. indexof (CHR )! =-1)
RET + = "%" + C. tostring (16 );
Else
RET + = CHR;
}
}
Return ret;
}
Urldecode:
Urldecode
Function urldecode (STR ){
VaR ret = "";
For (VAR I = 0; I <Str. length; I ++)
{
VaR CHR = Str. charat (I );
If (CHR = "+ ")
{
RET + = "";
}
Else if (CHR = "% ")
{
VaR ASC = Str. substring (I + 1, I + 3 );
If (parseint ("0x" + ASC)> 0x7f)
{
RET + = asc2str (parseint ("0x" + ASC + Str. substring (I + 4, I + 6 )));
I + = 5;
}
Else
{
RET + = asc2str (parseint ("0x" + ASC ));
I + = 2;
}
}
Else
{
RET + = CHR;
}
}
Return ret;
}