JSON characters changed in Angular HTTP GET
I am trying to get a JSON object from a fallback service. When I connect the url to my browser (Firefox or Chrome), I get JSON with the correct UTF-8 encoding:
{"name":"UniversitΓ©"}
However, when I try to GET the same URL in my Angular app, the text is not encoded correctly. This is the object printed to the JavaScript console:
{ name: "Universit "}
Here is the code I'm using in Angular:
$http(
{
method: "GET",
url: 'localhost:8080/my/url/location',
headers : {
"Accept":"application/json;charset=utf-8",
"Accept-Charset":"charset=utf-8"
}
}
).success(function(data,status,headers,config){
console.log(data);
/* the rest of the success function */
}).error(function(data,status,headers,config){
/* the rest of the failure function */
});
Any ideas? Thanks in advance!
+3
source to share