Fix joyent/node#8683

This PR fixed the encoding issue of converting external string into Buffer (#8683).
Ditto.