1

I'm extracting text from a Windows-1255-encoded webpage using Node.js. I'm trying to decode the text using the windows-1255.

After installing it using NPM and requiring it in the relevant file, I tried using it like this:

var title = windows1255.decode('#title').text());

This doesn't seem to have any effect. Any idea why?

Thanks!

Morgan

M Polak
  • 747
  • 7
  • 16

1 Answers1

1

don't know if you still waiting for an answer about this issue, but the following worked for me...

When fetching the data (a file), I set the get options of encoding to be binary:

var options = {
        method: 'GET',
        url: 'myURL',
        encoding: 'binary' 
    };

    request(options, function (error, response, body) {

        //deal with hebrew encoding
        csvString = encoding.convert(body, 'UTF8', "CP1255").toString();

Then for I switch encoding from CP1255 (=windows1255) to UTF8.

Hope it helps :)

IsraGab
  • 4,819
  • 3
  • 27
  • 46