|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
reading text file using streamreaderI have been trying to read a file, using "StreamReader" to pass the info to an string that is: ....dim stream as new FileStream(file,...) dim sr as new StreamReader(stream) dim data as string = sr.ReadToEnd... My problem is that in the file (is a text file) there is some data like: "... the company name is ¨CalifEx¨ and is located in ¨Austin¨..." when I use the streamreader to read the above text its returns: "... the company name is CalifEx and is located in Austin..." So streamreader miss the small doublequotes surrounding CalifEx and Austin. I think that some kind of encoding must be used before I read the file. How?, Any help?? Thanks, jamie
Show quote
Hide quote
"JM" <j***@ya.com> schrieb: Those characters are no "standard" double quote characters.> I have been trying to read a file, using "StreamReader" to pass the info > to an string that is: > > ...dim stream as new FileStream(file,...) > dim sr as new StreamReader(stream) > dim data as string = sr.ReadToEnd... > > My problem is that in the file (is a text file) there is some data like: > > "... the company name is ¨CalifEx¨ and is located in ¨Austin¨..." > > when I use the streamreader to read the above text its returns: > > "... the company name is CalifEx and is located in Austin..." > > So streamreader miss the small doublequotes surrounding CalifEx and > Austin. Which encoding has been used to store the file? You may want to pass 'System.Text.Encoding.Default' to the 'StreamReader' constructor in order to use the system's Windows-ANSI codepage to read the file. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
Help with first VB application - Data Entry form
Easy Value Compare Question Must call RemoveHandler after AddHandler? add row ro gridview CreateObject does not work consistently in X64 systems Simple SQL question Configuration file Software process question problem to read binary file Create a file hash |
|||||||||||||||||||||||