Can anyone tell me what is going on here?
byte[] stamp = new byte[]{0,0,0,0,0,1,177,115};
string serialize = System.Text.Encoding.UTF8.GetString(stamp);
byte[] deserialize = System.Text.Encoding.UTF8.GetBytes(serialize);
//deserialize == byte[]{0,0,0,0,0,1,239,191,189,115}
Why is stamp != deserialize??
In your original byte array, you have the 177
character, which is the plusminus sign. However during the serialization, that code isn't being recognized. It's being replaced by 239 191 189
which is the REPLACEMENT CHARACTER.
Here's a chart for reference. http://www.utf8-chartable.de/unicode-utf8-table.pl?start=65280&utf8=dec
I'm not quite sure WHY the plusminus sign isn't recognized, but that's why the byte arrays aren't equal. Other than that swap, they would be equal and the data isn't corrupted in any way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With