Skip to content

All node response parsers assume utf8 encoding #825

Open
@cmawhorter

Description

@cmawhorter

I noticed all parsers assume utf8.

e.g. text parser:

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions