node-request-caching icon indicating copy to clipboard operation
node-request-caching copied to clipboard

use a utf8 buffer for the requests

Open wilzbach opened this issue 10 years ago • 0 comments

Hi,

thanks for this great package. I just experienced problems when requesting utf8 documents. Imho we should make the request buffer utf8-encoded by default.

Here's a short example of downloading an utf8-encoded file:

var _ = require("underscore");
var RequestCaching = require("node-request-caching");
var url = "https://raw.githubusercontent.com/bbglab/muts-needle-plot/master/src/js/dependencies/d3.js";

var rc = new RequestCaching();

rc.get(
  url, {}, 1,
  function(err, res, body) {
    console.log(_.filter(body.split("\n"), function(e, i) {
      return i > 3387 && i < 3389;
    }).join("\n"));
  });

this should a utf8 string with λ and φ.

listener.point(sλ1, φ0);

BTW the current version returns the non-utf8 version:

listener.point(s��1, φ0);

wilzbach avatar Feb 27 '15 17:02 wilzbach