sentientwaffle / feed-read

fetch & parse ATOM & RSS feeds with Node.js
MIT License
74 stars 61 forks source link

the validate function returns false for utf-16le encoded feeds #4

Open eRGoon opened 10 years ago

eRGoon commented 10 years ago

I just convert all utf-16le encoded feeds to utf-8

if (enc && enc.toLowerCase() === "utf-16le") {
    var chars = [];

    for (var i = 0, l = body.length; i < l; i += 2) {
        chars.push(body.charCodeAt(i) | (body.charCodeAt(i + 1) << 8));
    }

    body = String.fromCharCode.apply(String, chars);
}