hy there
i finally did it like that.. maybe it is useful for somebody.
/*
function replaces extended characters of 'text' with its character
entities.
call the function by default with output = false. if you switch it
to true
it will format the source code for output in a textarea.
*/
function replaceExtChars(text,output) {
text = text.replace(eval('/&/g'), '&');
fromTo = new
Array('Æ','Æ','Á','Á','Â','Â',' À','À','Å','Å','Ã','Ã','Ä ','Ä','Ç','Ç','Ð','Ð','É','É','& Ecirc;','Ê','È','È','Ë','Ë','Í' ,'Í','Î','Î','Ì','Ì','Ï','Ï','&N tilde;','Ñ','Ó','Ó','Ô','Ô','Ò ','Ò','Ø','Ø','Õ','Õ','Ö','Ö',' Þ','Þ','Ú','Ú','Û','Û','Ù ;','Ù','Ü','Ü','Ý','Ý','á','á', 'â','â','æ','æ','à','à','å ;','å','ã','ã','ä','ä','¦','¦', 'ç','ç','¢','¢','©','©','°',' °','é','é','ê','ê','è','è','&e th;','ð','ë','ë','½','½','¼','¼ ','¾','¾','>','>','>','>','í',' í','î','î','¡','¡','ì','ì','&iq uest;','¿','ï','ï','«','«','<','<',' <','<','—','—','µ','µ','·','· ','–','–','¬','¬','ñ','ñ','&oacut e;','ó','ô','ô','ò','ò','&
oslash;','ø','õ','õ','ö','ö','¶', '¶','±','±','£','£','"','\"','&r aquo;','»','®','®','§','§','','*','¹ ;','¹','²','²','³','³','ß','ß','&t horn;','þ','˜','˜','™','™','ú', 'ú','û','û','ù','ù','ü','ü','&ya cute;','ý','¥','¥','ÿ','ÿ');
if (output) {
fromTo[fromTo.length] = '&';
fromTo[fromTo.length] = '&';
}
for (i=0; i < fromTo.length; i=i+2)
text = text.replace(eval('/'+fromTo[i+1]+'/g'), fromTo[i])
return (text);
}
cheers ralphie
us**@domain.invalid wrote:
hi there
has anyone of you writte a function to encode html from like '&' ->
'&' and likes to share it with me.. or can anybody give me a hint
how to set up something like that.
cheers me.
ralphie