Skip to content

Instantly share code, notes, and snippets.

@scotthansonde
Last active March 30, 2018 22:00
Show Gist options
  • Select an option

  • Save scotthansonde/c1ea2958d6aea935433873d60b58e6fe to your computer and use it in GitHub Desktop.

Select an option

Save scotthansonde/c1ea2958d6aea935433873d60b58e6fe to your computer and use it in GitHub Desktop.
decode.js passing encoding option to request
// This answer is wrong, see https://gist.github.com/papascott/d81264223a5d492af040ea6f0277e041
const Iconv = require("iconv").Iconv;
const request = require("request");
const urlTestFeed = "https://www.presseportal.de/rss/dienststelle_110972.rss2";
request({
uri: urlTestFeed,
encoding: "latin1"
},
function (err, response, theString) {
var iconv = new Iconv("ISO-8859-1", "UTF-8");
var newString = iconv.convert(theString).toString();
console.log(theString);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment