title: Hex to ascii wrong conversion
body: <p>I have got a javascript function to convert from HEX to ASCII and then output that to a serial connection.
  However when monitoring the serial connection, I can see that the converted output is not correct.</p>
  
  <p>I have this javascript code:</p>
  
  <pre><code>function hex2a(hexx) {
  var hex = hexx.toString();//force conversion
  var str = '';
  for (var i = 0; i &lt; hex.length; i += 2)
      str += String.fromCharCode(parseInt(hex.substr(i, 2), 16));
  return str;
  }
  return {payload: hex2a(msg.payload)}; // returns '2460'
  </code></pre>
  
  <p>As an example, i want to convert this HEX :</p>
  
  <pre><code>0340209c
  </code></pre>
  
  <p>BUT, when monitoring the serial connection i see that what gets actually sent is this:</p>
  
  <pre><code>03 40 20 c2 9c  
  </code></pre>
  
  <p>So the device answers with a fault message.
  I'm scratching my head here. Some hex commands do convert correctly ( 0340615b , for example).
  I'm outputting to the serial connection via node-red.
  The output node only seems to accept ascii text and not HEX.</p>
  
  <p>I hope someone can guide me in the right direction.
  Thank you for any reply!</p>