Reading foreign letters from text files

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")
 
G

Guest

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);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top