Attempting to retrieve a JSON object from a restful service has presented some encoding issues. When entering the URL into a browser such as Firefox or Chrome, the JSON is displayed properly with UTF-8 encoding:
{"name":"Université"}
However, when trying to GET the same URL within an Angular application, the text appears to be improperly encoded. The following is what is output in the JavaScript console:
{ name: "Universit"}
Below is the Angular code being used:
$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);
/* continue with success function */
}).error(function(data,status,headers,config){
/* continue with failure function */
});
Any insights on how to resolve this issue would be greatly appreciated. Thank you in advance!