There are many JS files on the InternetCodeConversion from GB to Unicode, But what JS reads when reading cookies is Unicode, now Chinese is displayed, so we have to use the look-up table method.
VaR STR;
Str = " % D6 % D0 % B9 % fa % B3 % CC % D0 % F2 % D4 % B1 % B4 % F3 % B1 % be % D3 % AA + % 3C % 3E % 22% 23% 25% 7b % 7D % 7C % 5E % 7E % 5B % 5d % 60% 26% 3f % 2 babc " ;
Alert (urldecode (STR ));
Function Urldecode (enstr) {
VaR Destr, strspecial
VaR C, I, V, Q, P, T, S;
Destr = "" ;
Strspecial = " ! \ " # $ % & '() * + ,. - _ / :; <=>? @ [\] ^ ` {|} ~ % " ;
For (I = 0; I <enstr. length; I ++ ){
C = enstr. substr (I, 1 );
If (C = " % " ){
Q = enstr. substr (I + 1, 2 );
V = eval ( " 0x " + Enstr. substr (I + 1, 2 ));
P = string. fromcharcode (v );
If (strspecial. indexof (p, 0 )! =-1 ){
Destr = destr + P;
I = I + 2;
}
Else {
Q = enstr. substr (I + 1, 2 );
T = eval ( " 0x " + Q)-0xb0;
Q = enstr. substr (I + 4, 2 );
S = eval ( " 0x " + Q)-0xa1;
If (T> = 0 & S> = 0 ){
V = T * 94 + S;
P = strgb. substr (V, 1 );
// V = eval ( " 0x " + Enstr. substr (I + 1, 2) + enstr. substr (I + 4, 2 ));
// P = string. fromcharcode (v );
Destr = destr + P;
I = I + 5;
}
Else {
V = eval ( " 0x " + Enstr. substr (I + 1, 2 ));
P = string. fromcharcode (v );
Destr = destr + P;
I = I + 2;
}
}
}
Else {
If (C = " + " ){
Destr = destr + " " ;
}
Else {
Destr = destr + C;
}
}
}
Return destr;
}
qswhgb2312.js is required before use. Http://files.cnblogs.com/feishu/qswhGB2312.js