Encoding 如何使用HtmlAlityPack在VB中声明编码?
我是编程新手,但我在本页中阅读了许多问题和答案,这些问题和答案对我帮助很大。我有一个可以在网页上查找信息并将其存储在数据库中的代码,到目前为止,我唯一的问题是文本带有重音字符,我不知道如何选择正确的编码Encoding 如何使用HtmlAlityPack在VB中声明编码?,encoding,html-agility-pack,Encoding,Html Agility Pack,我是编程新手,但我在本页中阅读了许多问题和答案,这些问题和答案对我帮助很大。我有一个可以在网页上查找信息并将其存储在数据库中的代码,到目前为止,我唯一的问题是文本带有重音字符,我不知道如何选择正确的编码 Dim Web1 As New HtmlAgilityPack.HtmlWeb Dim Doc1 As New HtmlAgilityPack.HtmlDocument Doc1 = Web1.Load("http://207.248.177.30/regulaciones/scd_exp
Dim Web1 As New HtmlAgilityPack.HtmlWeb
Dim Doc1 As New HtmlAgilityPack.HtmlDocument
Doc1 = Web1.Load("http://207.248.177.30/regulaciones/scd_expediente_3.asp?ID=01/0922/130214)
Dim uri As Uri = Nothing
Dim linksOnPage = From link In doc.DocumentNode.Descendants()
Where link.Name = "a" _
AndAlso link.Attributes("href") IsNot Nothing _
Let text = link.InnerText.Trim()
Let url = link.Attributes("href").Value
Where uri.TryCreate(url, UriKind.RelativeOrAbsolute, uri)
Dim postabla As Integer = 1
Dim fecha1 As HtmlNode
Dim ACR2 As HtmlNode
Dim ACR3 As HtmlNode
Dim ACR4 As HtmlNode
Dim ACR5 As HtmlNode
For Each link In linksOnPage
Dim cb As New OleDb.OleDbCommandBuilder(da)
Dim dsNewRow As DataRow
Dim value1 As String
value1 = link.url
If value1.Contains("207.248.177.30") Then
dsNewRow = ds.Tables("infoenlace").NewRow()
dsNewRow.Item("Expediente") = exped
dsNewRow.Item("TipoDocumento") = link.text
dsNewRow.Item("EnlaceWeb") = link.url
fecha1 = doc.DocumentNode.SelectSingleNode("//tr[@class='tituloPantalla']/following-sibling::tr[" & postabla & "]/td[2]")
dsNewRow.Item("Fecha") = fecha1.InnerHtml
fecha1 = doc.DocumentNode.SelectSingleNode("//tr[@class='tituloPantalla']/following-sibling::tr[" & postabla & "]/td[3]")
dsNewRow.Item("Remitente") = fecha1.InnerHtml
postabla = postabla + 2
ds.Tables("infoenlace").Rows.Add(dsNewRow)
da.Update(ds, "infoenlace")
Next
Return uri
End Function
非常感谢!问题是,代码没有记录“Nueva versión”,而是将“Nueva versión”放在“Nueva versión”上�n、 “这可能会对您有所帮助:谢谢奥斯卡,但该页面用于声明使用C#编码。谢谢奥斯卡,我曾尝试使用该页面解决我的问题,但该页面用于声明使用C#编码。我的代码使用VB,我在尝试修改它时迷失了方向。当我尝试以以下方式使用openRead时:Dim Doc1Client As New WebClient()Doc1=Web1.Load(Doc1Client.openRead(“&exped”),Encoding.UTF8)显示一个错误(类型为'System.IO.Stream'的值无法转换为'String'谢谢!在您的帮助下,我终于这样做了,直到现在我还没有尝试最后的注释: