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

Discussion in 'ASP .Net' started by Nathan Sokalski, Jun 7, 2005.

  1. 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

    http://www.nathansokalski.com/
     
    Nathan Sokalski, Jun 7, 2005
    #1
    1. Advertising

  2. Nathan Sokalski

    Cor Ligthert Guest

    Nathan,

    You mean something as

    > cellPoemText.Text = poemstreamreader.ReadToEnd()
    > poemstreamreader.Close()


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

    I hope this helps,

    Cor
     
    Cor Ligthert, Jun 7, 2005
    #2
    1. Advertising

  3. "Nathan Sokalski" <> 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
     
    Armin Zingler, Jun 7, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sacha Korell
    Replies:
    2
    Views:
    15,120
    Mattias Sjögren
    Sep 6, 2003
  2. .Net Sports
    Replies:
    11
    Views:
    1,477
    .Net Sports
    Jan 17, 2006
  3. Chris
    Replies:
    1
    Views:
    13,764
    Oisin
    Mar 24, 2006
  4. Replies:
    10
    Views:
    1,342
    Anno Siegel
    Apr 17, 2006
  5. Replies:
    2
    Views:
    137
    slebetman
    Jul 7, 2008
Loading...

Share This Page