Fabio wrote:
<snip>
Mmmm... what I want is a "double way" conversion.
Each character into the ASCII table has a corrisponding byte, so I want that
a char converted to a byte can be reversed having back the original value.
All the encoders exposed by System.Text I tried do some transformation on
the value and the original information can be lost.
<snip>
Can I have this bheavior directly via some .Net encoder?
The Windows ANSI encoding (engoding number 1252) usually works for me,
because (AFAIK) it doesn't apply any transformation to the individual
byte, i.e., there's a mapping from each byte value to each ANSI char,
for a total of 256 possible chars (control chars included).
Dim E As System.Text.Enc oding = _
System.Text.Enc oding.GetEncodi ng(1252)
Many encodigs use two or four bytes in the representation of a char;
others use a multibyte system where some specific byte values indicate
that the following sequence is a multibyte char.
This is not the case with the ANSI encoding. In ANSI, each byte value
matches a corresponding char. Of course, if the string you're encoding
contains chars outside the ANSI range, such chars will be
misrepresented. Also, if you read a non-ansi sequence of bytes and
convert them to a string using ANSI, you'll probably get some strange
results.
HTH.
Regards,
Branco.