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('Æ','Æ','Á','Á','Â','Â','À','À','Å','Å','Ã','Ã','Ä','Ä','Ç','Ç','Ð','Ð','É','É','Ê','Ê','È','È','Ë','Ë','Í','Í','Î','Î','Ì','Ì','Ï','Ï','Ñ','Ñ','Ó','Ó','Ô','Ô','Ò','Ò','Ø','Ø','Õ','Õ','Ö','Ö','Þ','Þ','Ú','Ú','Û','Û','Ù','Ù','Ü','Ü','Ý','Ý','á','á','â','â','æ','æ','à','à','å','å','ã','ã','ä','ä','¦','¦','ç','ç','¢','¢','©','©','°','°','é','é','ê','ê','è','è','ð','ð','ë','ë','½','½','¼','¼','¾','¾','>','>','>','>','í','í','î','î','¡','¡','ì','ì','¿','¿','ï','ï','«','«','<','<','<','<','—','—','µ','µ','·','·','–','–','¬','¬','ñ','ñ','ó','ó','ô','ô','ò','ò','&
oslash;','ø','õ','õ','ö','ö','¶','¶','±','±','£','£','"','\"','»','»','®','®','§','§','­','','¹','¹','²','²','³','³','ß','ß','þ','þ','˜','˜','™','™','ú','ú','û','û','ù','ù','ü','ü','ý','ý','¥','¥','ÿ','ÿ');
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)
return (text);
}
cheers ralphie