Fix joyent/node#8683

This PR fixed the encoding issue of converting external string into Buffer (#8683).
If I'm reading #8683 correctly the issue is that the length computation is incorrect. Creating a temporary string doesn't seem necessary at all. Why not just the length computation?