Ver Mensaje Individual
  #4 (permalink)  
Antiguo 07/04/2008, 14:51
Avatar de ElJavista
ElJavista
Colaborador
 
Fecha de Ingreso: marzo-2007
Ubicación: Lima Perú
Mensajes: 2.231
Antigüedad: 17 años, 1 mes
Puntos: 67
Re: Error con acentos con carga asíncrona

Claro que puedes solucionar tu problema, simplemente implementa una función que convierta los carácteres latinos a sus respectivas entidades HTML, una opción sería esta función:

Código:
function htmlent(txt) {
              txt = txt.replace(/á/g, "á");
              txt = txt.replace(/é/g, "é");
              txt = txt.replace(/í/g, "í");
              txt = txt.replace(/ó/g, "ó");
              txt = txt.replace(/ú/g, "ú");
              txt = txt.replace(/ñ/g, "ñ");
              return txt;
}
Esta función la aplicas de esta manera:

Código:
function setpage(pagecnx, id){
	if (pagecnx.readyState == 4 && (pagecnx.status==200 || window.location.href.indexOf("http")==-1))
	document.getElementById(id).innerHTML=htmlent(pagecnx.responseText);
}
Espero que te sirva.