Take a look at the following C# code (function extracted from the BuildProtectedURLWithValidity
function in http://wmsauth.org/examples):
byte[]
Casting between byte
and char
is like using the ISO-8859-1 encoding (= the first 256 characters of Unicode), except it silently loses information when encoding characters beyond U+00FF.
And besides, is the char actually bigger than a byte (I'm guessing 2 bytes) and will actually omit the first byte?
Yes. A C# char
= UTF-16 code unit = 2 bytes.