?
=?windows-1252?Q?Peter_Str=F8iman?=
Hi
I have a byte-array, in which one of the bytes has the value 149 (hex95)
which represents a dot ( • ). The same character has the unicode value
of 8226 (hex 2022)
But when I try to decode the byte-array into a string, that character is
not converted into the correct value.
If I use the following code:
byte[] b = new byte[] { 147 };
char[] c = System.Text.Encoding.GetEncoding("ISO-8859-1").GetChars(b);
c now contains the character value 147 - which is an illegal unicode value.
What am I doing wrong (actually asp.net is doing it wrong as well,
because if I enter that character in a text-field, then the wrong value
is stored in the database. So the character is not properly decoded when
the form is posted to the server)
Regards,
Pete
I have a byte-array, in which one of the bytes has the value 149 (hex95)
which represents a dot ( • ). The same character has the unicode value
of 8226 (hex 2022)
But when I try to decode the byte-array into a string, that character is
not converted into the correct value.
If I use the following code:
byte[] b = new byte[] { 147 };
char[] c = System.Text.Encoding.GetEncoding("ISO-8859-1").GetChars(b);
c now contains the character value 147 - which is an illegal unicode value.
What am I doing wrong (actually asp.net is doing it wrong as well,
because if I enter that character in a text-field, then the wrong value
is stored in the database. So the character is not properly decoded when
the form is posted to the server)
Regards,
Pete