title: Converting hexadecimal string to utf8 doesn't work from a chunk in node.js
body: <p>I am working with some data in node which has been stored in a database after being converted from a normal text string to a hex one.</p>
  
  <p>When I get this data back I can log the hex value in the console and check it on a site like <a href="http://string-functions.com/hex-string.aspx" rel="nofollow noreferrer">this</a> and it works however when I run it through what I think should convert it, it gives me nothing.</p>
  
  <p>It does work however if I manually enter the string (and not get it from the chunk in the web request).</p>
  
  <p>This works:</p>
  
  <pre><code>  var hex = "7b226461746574696d65223a22323031372d30372d31325432303a35323a34342e3432395a222c226465636973696f6e223a227061727479227d";
    var hexData = new Buffer(hex, 'hex').toString('utf8');
    console.log(hexData);
  </code></pre>
  
  <p>However this does not:</p>
  
  <pre><code>  var hex = chunk.toString();
    console.log(hex); // outputs "7b226461746574696d65223a22323031372d30372d31325432303a35323a34342e3432395a222c226465636973696f6e223a227061727479227d"
    var hexData = new Buffer(hex, 'hex').toString('utf8');
    console.log(hexData);
  </code></pre>
  
  <p>Even though I can see the data is the same in the console output</p>