1

I am using Outlook (2010 + 2013) VBA using MS XML 6.0 reference to load up a web page. I am having trouble to get the page with Hungarian accented characters. I tried to manipulate the charset to no avail.

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

Looking at the Hungarian Alphabet two of all characters are not shown properly:

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

They should look like this: Ő and Ű

I tried adding these line to the request, but it did not change anything:

    ie.setRequestHeader "Accept", "text/html;charset=UTF-8"
    ie.setRequestHeader "Accept-Encoding", "identity"
    ie.setRequestHeader "Accept-Charset", "UTF-8"

Anyone knows why?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
modzsi
  • 185
  • 2
  • 12
  • The response is in unicode, you'll need to convert it. See: https://msdn.microsoft.com/en-us/library/office/gg264628.aspx. Debug.print supports ASCII more or less, for unicode you'll need a different container. – Ryan Wildry Mar 22 '17 at 14:02

0 Answers0