I've to read JSON file encoded with utf-8 charset
I use this syntax:
$http.get('resources/negozi.json',
{header : {'Content-Type' : 'application/json; charset=UTF-8'}
}).success(function(data) {
... code here
});
But, the response header is:
Content-Type:text/plain; charset=ISO-8859-1
If I try to do this with jquery:
$.ajax({
type: "GET",
url: "resources/negozi.json",
contentType: "application/json; charset=utf-8",
dataType: "json",
The request header is correct. But, the response is the same.
Content-Type:text/plain; charset=ISO-8859-1
charset=ISO-8859-1and it is the truth - why would you care? These things are supposed work transparently, you shouldn't have to (and therefore can't easily) force the server to give you a certain charset. However, if the server sayscharset=ISO-8859-1and it is not the truth, you need to fix the server, not the client.