how can I get a string(chinese character) from a text file?

  • Thread starter Thread starter Guest
  • Start date Start date
Hi flybrid,

StreamReader sr = new StreamReader(filepath, System.Text.UnicodeEncoding);
string text = sr.ReadToEnd();
sr.Close();

This should get you a string of whatever is inside the file. This sample specifies Unicode as the text format of the file.

Happy coding!
Morten Wennevik [C# MVP]
 
Back
Top