title: Getting correct string from windows-1250 encoded web page with node.js
body: <p>I am trying to scrape some data from a <a href="http://www.foosball.sk/sk/zebricky/?action=view&amp;rank_name_id=513" rel="nofollow">webpage</a> with nodejs but I am having problems with character encoding.
  The web page states that it's encoding is:
  <code>&lt;meta http-equiv="Content-Type" content="text/html; charset=windows-1250"&gt;</code>
  And when I browse it with chrome it sets encoding to windows-1250 and everything looks fine.</p>
  
  <p>As there is no windows-1250 encoding/decoding for streams in node (and utf8 did not work), I found an iconv-lite package which should be able to easily convert between different encodings. But I still get wrong characters after I save the response into a file (or output into console). I also tried different encodings, native node buffer encodings, setting headers to the same as what I see in chrome (<code>Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3</code>) but nothing seems to work correctly.</p>
  
  <p>You can see the whole code in here <a href="https://gist.github.com/4110999" rel="nofollow">https://gist.github.com/4110999</a>.</p>
  
  <p>I suppose I am missing something fundamental regarding how the encoding works so any help on how to get the data with correct characters would be appreciated.</p>
  
  <p>EDIT:<br>
  Also tried the node-iconv package in case it is a package problem. Changed line 51 to:  </p>
  
  <pre><code>var decoder = new Iconv_native('WINDOWS-1250', 'UTF-8');  
  var decoded = decoder.convert(body).toString();
  </code></pre>
  
  <p>but still getting the same results.</p>