Sunday, September 05, 2004

Reading UNICODE from file

I was asked by some one to show how to read a UNICODE stream.
so this is the response!
reading a unicode from a file stream is as simple as this:
/// read the stream using StreamReader --- look for the constructor
/// with specified encoding !
using(System.IO.StreamReader l_rdr
= new System.IO.StreamReader(openFileDialog1.FileName,System.Text.Encoding.Unicode))
{
while( (l_strCurrent= l_rdr.ReadLine()) != null)
{
l_strBuilder.Append(l_strCurrent);
}
}

No comments: