When making an HTTP request like this:
return HttpClient.get("url", { headers: requestHeaders, responseType: 'text'});
What encoding is used when turning the response into a string?
Checking the official Angular Repository, for the Http Client we can look under common/http:
While looking into the official repo, you can only find a mention of encodings in one particular case, as seen here:
if (this.body instanceof HttpParams) {
return 'application/x-www-form-urlencoded;charset=UTF-8';
}
Checking in the network tab of an Angular application, you can see that it does not specify the encoding type, when sending a request, however, the response headers of the response may include it in the content-type property
if the sending server specified it.
Like mentioned in the comments, default is utf-8, as mentioned by jonrsharpe.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With