Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5974079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:53:32+00:00 2026-05-22T20:53:32+00:00

I’m writing a vbscript to pull some data from a webpage, strip out a

  • 0

I’m writing a vbscript to pull some data from a webpage, strip out a few key pieces of information and write those to a file.

At the moment my script to access the pages and save the file contents to a string is this:

Set WshShell = WScript.CreateObject("WScript.Shell")
Set http = CreateObject("Microsoft.XmlHttp")

'Load Webpage where address is URL
http.open "GET", URL, FALSE
http.send ""
'Assign webpage contents as a string to variable called Webpage
WEBPAGE = http.responseText

I need to save the content to a string so I can use a regular expression on it to pull out the content that I need.

This script works perfectly, EXCEPT for when the pages contain non-standard characters (such as é). When the page contains something like this, the script throws up an error and stops.

I’m guessing this is something to do with the encoding, but I can’t work out how to fix it. Can anyone point me in the right direction? Thanks guys

Edit

Thanks to the help here I realised I’ve asked the wrong question! It turns out I was downloading the content fine – the problem was, afterwards I was trying to edit it and write it out to a file, and the file was in the wrong format. I had this:

Set objTextFile = objFSO.OpenTextFile(OutputFile, 8, True,)

Changing it to this:

Set objTextFile = objFSO.OpenTextFile(OutputFile, 8, True, -1)

Seems to have fixed it. What a crazy world, eh? Thanks for the help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:53:33+00:00Added an answer on May 22, 2026 at 8:53 pm

    You may need to set the correct header blocks before send

    eg the following is an example only. You will need to find out what this is exactly for your website

       http.open "GET", URL, FALSE
        http.SetRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"
        http.SetRequestHeader "Accept", "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"
        http.SetRequestHeader "Accept-Language", "en-us,en;q=0.5"
        http.SetRequestHeader "Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7"
        http.send ""
    

    EDIT:

    What about this instead. It works ok here

    Dim XMLHttpReq,URL,WEBPAGE
    Const Eacute  = "%C3%89"
    
    Set XMLHttpReq = CreateObject("MSXML2.ServerXMLHTTP")
    
    URL = "http://en.wikipedia.org/wiki/%C3%89"
    'Load Webpage where address is URL
    XMLHttpReq.Open "GET", URL, False
    XMLHttpReq.send ""
    'Assign webpage contents as a string to variable called Webpage
    WEBPAGE = XMLHttpReq.responseText
    WEBPAGE = Replace(WEBPAGE, Eacute, "É")
    'Debug.Print WEBPAGE
    

    The E acute in this case returns as string %C3%89 and you can force it to whatever character you choose if required.

    EDIT2:

    Just to add, if you’re doing this with VBScript you may find this method useful

    Dim XMLHttpReq, URL, WEBPAGE, fso, f
    Const Eacute = "%C3%89"
    Set XMLHttpReq = CreateObject("MSXML2.ServerXMLHTTP")
    URL = "http://en.wikipedia.org/wiki/%C3%89"
    XMLHttpReq.Open "GET", URL, False
    XMLHttpReq.send ""
    WEBPAGE = XMLHttpReq.responseText
    
    Save2File WEBPAGE, "C:\Users\osknows\Desktop\test.txt"
    
    Sub Save2File (sText, sFile)
        Dim oStream
        Set oStream = CreateObject("ADODB.Stream")
        With oStream
            .Open
            .CharSet = "utf-8"
            .WriteText sText
            .SaveToFile sFile, 2
        End With
        Set oStream = Nothing
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some data like this: 1 2 3 4 5 9 2 6
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a bunch of posts stored in text files formatted in yaml/textile (from
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I am trying to loop through a bunch of documents I have to put
I'm making a simple page using Google Maps API 3. My first. One marker

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.