المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Extended Ascii charaters are not written in the text file....



C# Programming
05-06-2009, 01:52 PM
Hi all,

I am trying to convert a byte array in to a character array and trying to write the character array in a text file...
The character set till 127 is propetly written.. whereas all the characters which is above 127 is modified as '?' i.e ascii number 63.....
How can i write this to the text file...

the code snippet..

Byte[] encryptedData = myrsa.Encrypt(newdata, false);
Char[] asciiarray = encoding.GetChars(encryptedData);
FileStream fs = File.Open(FilePath,filemode,FileAccess.Write);
sw = new StreamWriter(fs, Encoding.ASCII );
sw.WriteLine(new string (asciiarray));
sw.Close();

The above code writes only ascii characters whose values are less than 127 whereas all other characters are automatically changed to '?'

Googled, but no fruits......

Have a Happy Coding.....