views:

93

answers:

1

Hello
I want in Gadget, Write Unicode data in XML File(I use UTF-8 to encode the XML document).
for Write to XML, Use " fso = new ActiveXObject("Scripting.FileSystemObject"); ".
But after Write, data not Unicode.
In Addition, I need Data as Unicode.
Thanks

A: 

Hi, Solved.
var objStream = new ActiveXObject("ADODB.Stream");
objStream.Type = 2;//1=Binary Data , 2=Text Data(Default)
objStream.Open();
objStream.charset ="UTF-8";
objStream.WriteText(Data);
objStream.SaveToFile(System.Gadget.path + "\PhonebookContacts.xml",2);
//1=Creates a new file if the file does not already exist(Default)
//2=Overwrites the file with the data from the currently open Stream object, if the file already exists

Modir