To get the encoding of the page, if you use IE browser, you can use document.charset. If you use Firefox, you need to use
document.characterSet.
function getPageCharset(){
var charSet = " ";
var oType = getBrowser();
switch(oType){
case "IE":
charSet = document.charset;
break;
case "FIREFOX":
charSet = document.characterSet;
break;
default:
break;
}
return charSet;
}
//Get The type of browser is IE or Firefox
function getBrowser() {
var oType = "";
if(navigator.userAgent.indexOf("MSIE")!=-1){
oType="IE";
}else if(navigator.userAgent .indexOf("Firefox")!=-1){
oType="FIREFOX";
}
return oType;
}