forwardemail / forwardemail/superagent
All node response parsers assume utf8 encoding
Open
Feature
Semver-Major
- Dominant language
- JavaScript
- Stars
- 16.6k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
I noticed [all parsers assume utf8](https://github.com/visionmedia/superagent/blob/e11119b0b6956e3a57d24c9093ee3057d33bde62/lib/node/parsers/text.js#L4).
e.g. text parser:
``` javascript
module.exports = function(res, fn){
res.text = '';
res.setEncoding('utf8');
res.on('data', function(chunk){ res.text += chunk; });
res.on('end', fn);
};
```
It seems like they all should get the encoding from the response content-type header and fall back to binary (application/octet-stream) if none exists.
Can PR, if desired.
Contributor guide
Assessment
This issue has not been assessed yet.