Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VBScript
Hi,
Here is the sample code I am using for generating the HTML file but it fails to support UTF8, it creates the html with %CD%%..etc

Set xmlSource = CreateObject("MSXML2.DOMDocument")
Set xmlXForm = CreateObject("MSXML2.DOMDocument")
Set args = WScript.Arguments
xmlFile = args.Item(0)
xslFile = args.Item(1)
outputFile = args.Item(2)
 
Set fileSystemObject = CreateObject("Scripting.FileSystemObject")
fileSystemObject.CreateTextFile(outputfile)
Set fileObject = fileSystemObject.GetFile(outputfile)
Set outFileStream = fileObject.OpenAsTextStream(2,-1)
outFileStream.Write(output)
outFileStream.Close

I found a solution in java script but it throws error saying runtimeerror, here is that sample, can some one correct it.

Set fileSystemObject = CreateObject("Scripting.FileSystemObject")
Set utf8Enc = new ActiveXObject("Utf8Lib.Utf8Enc");
 
fileSystemObject.CreateTextFile(outputfile)
Set fileObject = fileSystemObject.GetFile(outputfile)
Set outFileStream = fileObject.OpenAsTextStream(2,-1)
outFileStream.Write(utf8Enc.UnicodeT(output))
outFileStream.Close

thanks in advance
Posted 19-Jul-12 10:09am
Edited 19-Jul-12 10:16am
(no name)130K
v2
Comments
Sandeep Mewara at 20-Jul-12 18:25pm
   
Share exact error.
priypavan at 23-Jul-12 12:32pm
   
Exact Error is : ADODB.Stream: Write to file failed.
priypavan at 26-Jul-12 20:00pm
   
any update on this?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 229
1 OriginalGriff 225
2 Suvendu Shekhar Giri 205
3 PIEBALDconsult 180
4 Peter Leow 135
0 Sergey Alexandrovich Kryukov 6,434
1 OriginalGriff 6,033
2 Peter Leow 2,534
3 Maciej Los 2,268
4 Abhinav S 2,264


Advertise | Privacy | Mobile
Web02 | 2.8.150414.1 | Last Updated 19 Jul 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100