ASP to HTML file

J

Jenny Shum

Hi!

I'm trying to write HTML parsed from an ASP page (by XMLHTTP object) into a
newly created .txt or .html file.

It gives me "Invalid procedure call or argument" error every time there is a
funny character on the ASP page (like ?, £, or some French alphabet chars)
Works fine with all other pages (containing no such characters).

Here is the code:

url = cStr("http://www.blah.com/blah.asp")
set xmlhttp = server.CreateObject("Microsoft.XMLHTTP")
xmlhttp.open "GET", url, false
xmlhttp.send

SET myFSO = Server.CreateObject("Scripting.FileSystemObject")

If NOT myFSO.FileExists("D:\FOLDER\TextFile.txt") Then
myFSO.CreateTextFile("D:\FOLDER\TextFile.txt")
end if

If myFSO.FileExists("D:\FOLDER\TextFile.txt") Then
SET objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objTextStream = objFSO.OpenTextFile("D:\FOLDER\TextFile.txt",
fsoForWriting, True)
objTextStream.WriteLine xmlhttp.responseText
end if

Does anybody know how to encode the initial page to convert the wrong
symbols into something else please.

Thank you

Jenny
 
F

F@yy@Z

I am facing the same problem as well.

I am replacing the special charachter to its unicode like myString =
Replace(myString, "£", "¦") Its working fine but for only known values
(characters).

Can any one Advise ?. I tried .HTMLEncode("Ø") but its not working.

Regards

Fayyaz
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,132
Messages
2,570,775
Members
47,332
Latest member
datacos561

Latest Threads

Top