I encounter this problem for the first time and don't find anything about it on the web.
Through Angular Http API, I query an SQL Plus server hosted on IIS that sends me back a json with the following header: Content-Type:text/html; charset=utf-8
. But in my application the received accented character are all transformed into their html code counterparts: é => é
, è => è
and so on.
This is a sample request I made:
let URI = '...';
return this._http.get(URI)
.map(
response => {
console.debug(response);
return data;
}
);
And a result excerpt is like this when logging from within the Angular app:
[
{
{
i: 0,
v: "97"
},
{
i: 1,
v: "éo"
},
{
i: 2,
v: "2;1"
},
{
i: 3,
v: "0"
}
}
]
But if I query the server directly using Chrome, IE and Firefox, by pasting the exact same URL in the navigation bar, the result is correct:
[
{
{
"i": 0,
"v": "97"
},
{
"i": 1,
"v": "é"
},
{
"i": 2,
"v": "2;1"
},
{
"i": 3,
"v": "0"
}
}
]
Both request have the same headers exactly, so I can only assume that Angular's http API is changing the response somehow but I don't know how to correct this. I tried using decoreURI and decodeURIComponent methods without any success.
I hope somebody has already encountered this issue and fixed it ?
EDIT: I'm using Angular 4.3.6 and Angular CLI 1.2.1