Author: writetoatif | Posted on: 3/10/2010 7:19:15 AM | Views : 416

In .net streams are by default encoded in utf-8. so what i want to do is to simply read the text in a textbox in which i paste the russian characters and then convert them to ascii. but when i debug the code then in my resulting string ??????? appears. Tell me that how i can convert the string into its ascii equivalent. my code is given below
string inputString = txtName.Text;
ASCIIEncoding ascii = new ASCIIEncoding();
Encoding encoder = ASCIIEncoding.GetEncoding("us-ascii", new EncoderReplacementFallback(string.Empty), new DecoderExceptionFallback());

byte[] bAsciiString = encoder.GetBytes(inputString);
string cleanString = ascii.GetString(bAsciiString);
...

Go to the complete details ...