Reading foreign letters from text files

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

The typical foreign letters in the text file I read are missing. Has it
something to do with the declaration of the file?
Dim sr As StreamReader = File.OpenText("c:\MyFile.txt")
 
You might want to try opening the file specifying the charset. For instance
create a new StreamReader using the system's default ANSI charset:

vb.net:
Dim sr as StreamReader = new StreamReader("c:\myfile.txt",
System.Text.Encoding.Default)

c#:
StreamReader sr = new StreamReader(@"c:\myfile.txt",
System.Text.Encoding.Default);
 
Back
Top