我使用Outlook(2010 + 2013)VBA使用MS XML 6.0引用来加载网页。我无法获得带有匈牙利语重音字符的页面。我试图操纵charset无济于事。
Sub TEST()
Dim url As String
url = "https://hu.wikipedia.org/wiki/Magyar_%C3%A1b%C3%A9c%C3%A9"
Dim dictObj As Object: Set dictObj = CreateObject("Scripting.Dictionary")
Dim ie As MSXML2.XMLHTTP60
Set ie = New MSXML2.XMLHTTP60
ie.Open "GET", url, False
ie.Send
While ie.ReadyState <> 4
DoEvents
Wend
Dim HTMLDoc As MSHTML.HTMLDocument
Dim HTMLBody As MSHTML.HTMLBody
Set HTMLDoc = New MSHTML.HTMLDocument
Set HTMLBody = HTMLDoc.Body
HTMLBody.innerHTML = ie.responseText
Debug.Print HTMLBody.innerText
End Sub
查看匈牙利字母表中的两个字符未正确显示:
A,Á,B,C,Cs,D,Dz,Dzs,E,É,F,G,Gy,H,I,Í,J,K,L,Ly,M, N,Ny,O,Ó,Ö, O ,P,R,S,Sz,T,Ty,U,Ú,Ü, U ,V,Z, ZS
他们应该是这样的:Ő和Ű
我尝试将这些行添加到请求中,但它没有改变任何内容:
ie.setRequestHeader "Accept", "text/html;charset=UTF-8"
ie.setRequestHeader "Accept-Encoding", "identity"
ie.setRequestHeader "Accept-Charset", "UTF-8"
任何人都知道为什么?