
//on se contente de prendre la valeur du caractère
function htmlEntities(a){
	if(typeof a != 'string') return null;
	var retour = '';
	for(var i=0;i<a.length;i++){
		var b = a.charAt(i);
		//if(b>='a'&&b<='z'||b>='A'&&b<='Z'||b>='0'&&b<='9'||b=='&'||b==';'||b=='\n'||b=='\t'){
		if(b<256){
			retour += b;
		}else{
			retour += "&#"+a.charCodeAt(i)+';';
		}
	}
	return retour;
}

//le navigateur se charge de faire le boulot pour nous
function htmlEntityDecode(a){
	var tmp = document.createElement('div');
	tmp.innerHTML = a;
	return tmp.innerHTML.replace(/&amp;/,'&');
}
