View Single Post
  #1 (permalink)  
Old March 7th, 2009, 01:02 AM
grotgod grotgod is offline
Registered User
 
Join Date: Mar 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using ASP classic filesystem object to retrieve a xml file turns characters into Chin


Hello;

I have a pretty interesting problem here.

I read an xml file from the server using the fileSystem object. However...the text "magically" turn into Chinese characters.

If I take a look at the xml file in notepad it seems fine (normal English xml), but as soon as I read the individual lines of the file using the filesystem object I get the weird characters.

The code I use to access the file is pretty standard:

var FileObj,this_file;
var txt_arr = new Array();

FileObj = Server.CreateObject("Scripting.FileSystemObject");
this_file = FileObj.OpenTextFile(Server.MapPath("xmlfile.xml") );

while(!this_file.AtEndOfStream)
{
txt_arr[txt_arr.length] = this_file.ReadLine();
}


Response.Write(txt_arr);

Has anybody ever come across something like this before?
Reply With Quote