CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2009
    Posts
    252

    [RESOLVED] HttpRequest generating weird strings ' and "...

    This is my code these strings dont show up when I use Webrowser control btw. I think it has to be with the encoding so I explicitly assigned UTF8 to the streamreader with no success any idea about how to fix this pls?

    Code:
        Sub HttpRequest(url As String)
            Try
                Dim myRequest As System.Net.HttpWebRequest = WebRequest.Create(url)
                myRequest.Credentials = CredentialCache.DefaultCredentials
    
                '// Get the response
    
                Dim webResponse As WebResponse = myRequest.GetResponse
                Dim respStream As Stream = webResponse.GetResponseStream
    
                '//
    
                Dim ioStream As StreamReader = New StreamReader(respStream, Encoding.UTF8)
                Dim pageContent As String = ioStream.ReadToEnd
    
                MsgBox(pageContent)
    
            Catch ex As Exception
                Label1.Text = ex.Message
            End Try
        End Sub
    
    End Class
    Thx in advance!!

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: HttpRequest generating weird strings ' and "...

    <&#39> means apostrophe. See http://arvinditsolution.blogspot.ch/...does-mean.html
    <&quot;> means the quotation mark. See http://stackoverflow.com/questions/2...hat-quot-means
    Victor Nijegorodov

  3. #3
    Join Date
    Feb 2009
    Posts
    252

    Re: HttpRequest generating weird strings &#39; and &quot;...

    Thx victor i solved it yesterday, ill post the answer for the sake of future visitors and i hoppe it helps anyone else.

    System.Net.WebUtility.HtmlDecode

    Code:
    Descripcion = System.Net.WebUtility.HtmlDecode(Descripcion)
    Thx for your time

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured