1
Answer

Problem Reading unicode files

Jason Hedrick

Jason Hedrick

16y
9.6k
1
Below is the code I am using to attempt to open a text file.  Are there any problems with it?  Every time i run it only the first character of the file is read.  I am attempting to read from unicode .txt files if that makes a difference.

PS:  Ok i just checked only my unicoded .txt files wont open correctly.  Standard .txt files will.

if (openFileDialog1.ShowDialog() != DialogResult.Cancel) 
            { 
                StreamReader fs =new StreamReader( new FileStream(openFileDialog1.FileName, FileMode.OpenOrCreate, FileAccess.Read)); 
                while (fs.Peek() != -1) 
                { 
                    leftBox.Text += fs.ReadToEnd(); 
                } 
                fs.Close(); 
            } 


Answers (1)