Character error when using MSXML2

levifunk

New Member
Joined
Mar 14, 2011
Messages
20
I'm having a problem downloading data when the website uses foreign or special characters. In this case "Rübæus"

Here is my code:
Code:
Dim xmlhttp As New MSXML2.XMLHTTP50
Dim text1 As String
xmlhttp.Open "GET", "http://beeradvocate.com/beer/profile/1199/23474", False
xmlhttp.send
text1 = xmlhttp.responseText
Sheets("Sheet1").Cells(1, 1) = text1

If you look at what is written on Sheet 1, in the 4th line of text returned you'll see this:
title>Founders R￿- Founders Brewing Company - Grand Rapids, MI - BeerAdvocate /title>
<br>
<b>instead of:</b>
title>Founders R<b>übæus</b>- Founders Brewing Company - Grand Rapids, MI - BeerAdvocate /title>
<br>
It is obviously erroring when trying to write out the "ü"

Any thoughts?!
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
@John-

actually there is a little problem with this section:

Code:
    body = ""
    For i = 1 To Len(XMLHttp.responseBody)
        body = body & Chr(XMLHttp.responseBody(i))
    Next

Len() isn't getting the full length, which leaves me without the bottom of the website...

Is there a different loop that would be more appropriate?
 
Upvote 0
Change it to:

Code:
    Dim char As Variant
    body = ""
    For Each char In XMLHttp.responseBody
        body = body & Chr(char)
    Next
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,930
Members
452,367
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top