HttpRequest生成奇怪的字符串'和“

时间:2015-03-02 01:41:11

标签: vb.net

这是我的代码,当我使用Webrowser控制btw时,这些字符串不显示。我认为必须使用编码,所以我明确地将UTF8分配给了流式读取器,并没有成功地知道如何解决这个问题吗?

    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

这是一个问题的解决方案"观看cubo Vine现在不运行"

1 个答案:

答案 0 :(得分:1)

这些字符串对我来说看起来比较正常。如果您需要有关实体的信息,请参阅this

[按@Dan-o]

.NET具有转换实体的功能。查看 System.Net.WebUtility