I have to return a plain text got from a file from server and show in my webpage.
I am getting the file fine with ajax but I have problems with accents because it is in spanish and I have special characters like á, é, í...
Instead of that, I am getting squares with interrogation mark inside.
txt file has the correct symbol and I see it fine inside of it.
This is how I am getting and showing the file:
$.when(
$.ajax({
type: "POST",
url: urlServer+"openDocument.php",
contentType: "application/text; charset=utf-8",
dataType: "text",
success: function(response) {
respuesta = response;
},
error: function(xhr, status, message) { alert("Status: " + status + "\nsaveDocument: " + message); }
})
).then(function(){
//console.log(respuesta);
document.getElementById("divInfo").innerHTML = respuesta;
}
);