I'm using VBSCript to read a file and merge it into an existing asp/html file.
Here is the code:
' Create a filesystem object
Dim FSO
set FSO = server.createObject("Scrip
ting.FileS
ystemObjec
t")
' Map the logical path to the physical system path
Dim Filepath
Filepath = Server.MapPath(Filename)
if FSO.FileExists(Filepath) Then
Set TextStream = FSO.OpenTextFile(Filepath,
ForReading, False,TristateUseDefault)
Dim Contents
Contents = TextStream.ReadAll
TextStream.Close
Set TextStream = nothing
End If
Set FSO = nothing
Later in the page I render the Contents variable out on the page <% Response.Write(Contents)%>
basically it looks like this:
<!-- #INCLUDE File="html_header.asp" -->
<% Response.Write(Contents)%>
<!-- #INCLUDE File="html_footer.asp" -->
If I view the contents source HTM file alone it looks as expected. But when it is pulled through using the OpenTextFile method it replaces apostrophe's, copyright, and other "symbols" with strange characters. I've already tried changing the OpenTextFile format property to all 4 settings with no resolution. I've also open the source htm file in Notepad2 and saved it back out with the following encoding ANSI, Unicode, and UTF-8 also with no luck.
I need a solution to this problem using the built in VBScript methods if possible. I don't want to use iframes unless they will automatically expand to fit the contents without using javascript and without a border or scroll bar. The contents need to fill the page just as if the header and footer includes were part of the content htm file to beging with.
Start Free Trial