user6974: They say a image speaks louder then 1000 words so:

As you can see from the image above, this should work ?
What am i missing here? 
This is my encode function,
http://cryptocoinjs.com/modules/currency/coinstring/
I can confirm the private key spitted out is in correct format for if i do a dump i get:
$ ./src/d-cli dumpprivkey WRSybD94sWugjAQ89zyvbLsnw76ovCYEGo
BxkN86fdFBN75Aat3WCDs9w6NRHCMJJvvrDgb44Vcc23f96ohFZ5


user6974: The issue as suggest by Andrew was in the encode function.
After using https://www.npmjs.com/package/wif everything worked perfectly as intended.

6974: <p>They say a image speaks louder then 1000 words so:</p>

<p><a href="https://i.stack.imgur.com/MtgRU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MtgRU.png" alt="enter image description here"></a></p>

<p>As you can see from the image above, this should work ?
What am i missing here? </p>

<p>This is my encode function,
<a href="http://cryptocoinjs.com/modules/currency/coinstring/" rel="nofollow noreferrer">http://cryptocoinjs.com/modules/currency/coinstring/</a></p>

<p>I can confirm the private key spitted out is in correct format for if i do a dump i get:</p>

<pre><code>$ ./src/d-cli dumpprivkey WRSybD94sWugjAQ89zyvbLsnw76ovCYEGo
BxkN86fdFBN75Aat3WCDs9w6NRHCMJJvvrDgb44Vcc23f96ohFZ5
</code></pre>
 6974: <p>The issue as suggest by Andrew was in the encode function.
After using <a href="https://www.npmjs.com/package/wif" rel="nofollow noreferrer">https://www.npmjs.com/package/wif</a> everything worked perfectly as intended.</p>
