方法一:
function gb2utf8(data){ var glbEncode = [];
gb2utf8_data = 資料;
execScript("gb2utf8_data = MidB(gb2utf8_data, 1)", "Bp. data).replace(/%u /g,"").replace(/(.{2})(.{2})/g,"%$2%$1").replace (/%([A-Z].)%(.{2}) /g,"@$1$2");
t=t.split("@");
var i=0,j=t.length,k;
var i=0,j=t.length,k;
var i=0,j=t.length,k;
k=t[i].substring(0,4);
if(!glbEncode[k]) gb2utf8_char = eval("0x" k);
execScript( "gb2utf8_char = Chr(gb2utf8_char)", "VBScript");
glbEncode[k]=escape(gb2 8_char).substring glbEncode[k]=escape(gb2 t[i]=glbEncode[k] t[i].substring(4);
}
gb2utf8_data = gb2utf8_char = null;
return unescape(t.join("%"));
}
使用時:xxx.innerHTML=gb2utf8(req.responseBody);
方法二:
複製代碼
代碼如下: 在java類別中對抗使用: (適用於ajax)
複製程式碼