Diablo <(E-Mail Removed)> wrote:
> I am converting a byte array to string using
> System.Text.Encoding.UTF8.GetString() or Unicode.GetString(). Then the
> resulting text is converted back to binary, using the reverse function:
> System.Text.Encoding.UTF8.GetBytes() or Unicode.GetBytes.
> But the result does not match the original byte array!
> Is the conversion loosing some characters? Why?
Presumably because the original binary data isn't a valid UTF-8 byte
sequence.
You shouldn't use encodings like this to convert arbitrary binary data
into text - use Convert.ToBase64String instead.
--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too