By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,534 Members | 865 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,534 IT Pros & Developers. It's quick & easy.

System.IO.StreamReader is not returning single quotes from my file

P: n/a
I am using a System.IO.StreamReader to read a text file that was created
with Notepad. It is returning everything except the single quotes (at least
that is the only thing I have noticed it is not returning). The code I am
using is:

Dim poemstreamreader As System.IO.StreamReader

poemstreamreader = System.IO.File.OpenText(Global.Poems(poemtitle))

cellPoemText.Text = poemstreamreader.ReadToEnd()

poemstreamreader.Close()
I know that it is reading from the correct file, because it is returning all
the characters correctly, I simply need to know how to make it not discard
special characters such as single quotes. How do I do this? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Nathan,

You mean something as
cellPoemText.Text = poemstreamreader.ReadToEnd()
poemstreamreader.Close()


cellPoemText.Text = cellPoemText.Text.Replace("'","")

I hope this helps,

Cor
Nov 21 '05 #2

P: n/a
"Nathan Sokalski" <nj********@hotmail.com> schrieb
I am using a System.IO.StreamReader to read a text file that was
created with Notepad. It is returning everything except the single quotes
(at
least that is the only thing I have noticed it is not returning).
The code I am using is:

Dim poemstreamreader As System.IO.StreamReader

poemstreamreader =
System.IO.File.OpenText(Global.Poems(poemtitle))
cellPoemText.Text = poemstreamreader.ReadToEnd()

poemstreamreader.Close()
I know that it is reading from the correct file, because it is
returning all the characters correctly, I simply need to know how to
make it not discard special characters such as single quotes. How do
I do this?

Don't know if this helps:

poemstreamreader = new io.streamreader(Global.Poems(poemtitle),
system.text.encoding.default)

This assumes ANSI encoding of the file.
Armin

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.