|
|||
|
Hi All,
I want to save a xml file in unicode Format. I have gone through the thrread on same topic http://www.topcmm.com/forum/thread_1_1032.html But it saves the xml in UTF-8. Ieant to save the file in UNICODE or UTF-16 Thank in advance Mahesh Kokadwar |
|
|||
|
Code:
var f = new FileStream("c:\\my.xml", "w");
f.write('<?xml version="1.0" encoding="unicode"?>');
f.wrteUnicodeString(xml);
// the writeUnicodeString will write two '0's after the string, remove it
f.length = f.length - 2;
f.close();
|
|
|||
|
Hi
File Stream method would just add the encoding line to the XML but would still save the file in ANSI format. Try this thing: //---------Start var sFinalText="<pages><page>test Page</page></pages>" var objStream=new ActiveXObject("ADODB.Stream"); objStream.Open objStream.Position = 0 objStream.Charset = "UTF-16" objStream.WriteText= sFinalText objStream.SaveToFile= "text.xml" //--------End This would do save the file in UNICODE format. |
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|