Encoding issue with Axios

My approach was this:

  1. Make the request with responseType and responseEncoding set as below
const response = await axios.request({
  method: 'GET',
  url: 'https://www.example.com',
  responseType: 'arraybuffer',
  responseEncoding: 'binary'
});
  1. Decode reponse.data to the desired format
let html = iso88592.decode(response.data.toString('binary'));

Note: In my case, I needed to decode it using this package.


Without using interceptor or another package, I got the response on a buffer with:

notifications = await axios.request({
    method: 'GET',
    url: Link,
    responseType: 'arraybuffer',
    reponseEncoding: 'binary'
});

And next converting it with:

let html = notifications.data.toString('latin1');