Hello,

I am experiencing a (in my opinion) strange behavior:

var buf = crypto.randomBytes(0xf);
var buf2 = new Buffer(buf.toString());

// returns false
buf.toString() === buf2.toString()

I assume that randomBytes generates some values which cannot be encoded to 
`utf-8` so that they are missing or require more bytes.
But shouldn't utf8 use all eight bits of a byte? Is there a work around 
which allows to use utf-8 without having to worry about data integrity?

PS: Using hex or base64 encoding works fine.

Regards Bodo

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to