StreamReader FileInfo

G

Guest

I am reading a text file using the StreamReader class, I am looking for
prices of goods i.e. DAB Radio £230.00
As I read each line, I notice that the £ (pound) sign is missing
can anyone shed light on this issue?

code snippet......

StreamReader sr = fi.OpenText(); (fi being the text file)

while ((s = sr.ReadLine()) != null)
{
...read line into string here
}
 
G

Guest

sorry, i have found the answer, need to encode the stream

Encoding ecp1252 = Encoding.GetEncoding( 1252 );
StreamReader sr = new StreamReader( fi.FullName, ecp1252, false );
 

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