QUOTE(zahugi @ 14 Sep, 2008 - 11:15 PM)

hello,
I m trying to write small program convering from string to ascii then converting back from ascii to string.
converting from string to ascii is ok, but to convert from ascii to string it gives me the ascii not string.
my code is:
CODE
ASCIIEncoding ascii = new ASCIIEncoding();
byte[] a = ascii.GetBytes(textBox2.Text);
string b = Encoding.ASCII.GetString(a,0,a.Length);
textBox3.Text = textBox3.Text + b.ToString ();
Hi.
I am not sure if I am correct, since I am fairly new to C# as well. But as far as I know, .NET uses Unicode (UTF8) strings.
So you can try doing this something like this
CODE
byte[] a = new byte[b.Length];
char[] s = new char[b.Length];
int i;
s = b.ToCharArray();
for (i = 0; i <= b.Length; i++)
{
a[i] = (byte)s[i];
}
UTF8Encoding.Convert(Encoding.ASCII, Encoding.UTF8, a);
textBox3.Text = textBox3.Text + a.ToString();
I dont know if this code will work or not, but I hope this helps.
Good luck!