G
gizmo
Hi,
Here's a little hack I put together to try to get to the bottom of a
problem I'm having with trying to base64 encode a hash value. The hash
value contains character codes 135 and 130 amongst others.
This snippet will set up a string of chars 190, 135, 130, 73, 242, 243,
10. It puts them into a bytearray.
string encodedData;
byte[] andBackAgainBytes;
char a1 = (char)190;
char a2 = (char)135;
char a3 = (char)130;
char a4 = (char)73;
char a5 = (char)242;
char a6 = (char)243;
char a7 = (char)10;
string data = a1.ToString() + a2.ToString() + a3.ToString() +
a4.ToString() + a5.ToString() + a6.ToString() + a7.ToString();
byte[] encData_byte = new byte[data.Length];
encData_byte = System.Text.Encoding.Default.GetBytes(data);
However when debugging I look at the resulting byte array I see the
following character codes:
190, 63, 63, 73, 242, 243, 10
Note: the ANSI character "single baseline quote" is char 130 and
"dagger (double)" is char 135.
Any idea what happended to chars 130 and 135. I know a work around but
I'm curious as to why this is the case.
Thanks
Gizmo
Here's a little hack I put together to try to get to the bottom of a
problem I'm having with trying to base64 encode a hash value. The hash
value contains character codes 135 and 130 amongst others.
This snippet will set up a string of chars 190, 135, 130, 73, 242, 243,
10. It puts them into a bytearray.
string encodedData;
byte[] andBackAgainBytes;
char a1 = (char)190;
char a2 = (char)135;
char a3 = (char)130;
char a4 = (char)73;
char a5 = (char)242;
char a6 = (char)243;
char a7 = (char)10;
string data = a1.ToString() + a2.ToString() + a3.ToString() +
a4.ToString() + a5.ToString() + a6.ToString() + a7.ToString();
byte[] encData_byte = new byte[data.Length];
encData_byte = System.Text.Encoding.Default.GetBytes(data);
However when debugging I look at the resulting byte array I see the
following character codes:
190, 63, 63, 73, 242, 243, 10
Note: the ANSI character "single baseline quote" is char 130 and
"dagger (double)" is char 135.
Any idea what happended to chars 130 and 135. I know a work around but
I'm curious as to why this is the case.
Thanks
Gizmo